How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

March 31, 2008

Install “Apache, PHP, MySql”

Filed under: Linux — admin @ 2:16 pm

Hello. This howto contains how to install Apache, PHP, Mysql.
First we need to install apache so let’s start with this.

——————-
Apache 2.0.54
——————-

First, we need to download the latest version of Apache.

1) wget http://apache.zone-h.org/httpd/httpd-2.0.54.tar.gz

Now we need to ungzip it and cd to the apache’s dir.

2) tar zxvf httpd-2.0.54.tar.gz

3) cd httpd-2.0.54.tar.gz

Now, let’s configure the apache with using the most common options.

4) ./configure –prefix=/usr/local/apache2 –enable-info –enable-ssl –enable-module=so –enable-rewrite –enable-so

Let’s compile it!

5) make

Now, let’s install it.

6) make install

And that’s it! Apache should be installed. Apache’s dir is /usr/local/apache2
Conf file is located in /usr/local/apache2/conf/httpd.conf

You can start apache like this: /usr/local/apache2/bin/apachectl start
And please remember, you don’t need to restart apache if your going to change the configfile, you can easily reload the config file
/usr/local/apache2/bin/apachectl graceful

——————-
Mysql 4.1.12
——————-

Ok, we need to first add the mysql user and group.

1)

groupadd mysql
useradd mysql -g mysql

on FreeBSD:

pw group add mysql
pw user add mysql -g mysql

Now, we need to download the latest version of Mysql4.1 ( Which is a recommended version. )

2) wget http://dev.mysql.com/get/Downloads/….gov/pub/mysql/
http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-4.1.12.tar.gz/from/ftp://mirror.mcs.anl.gov/pub/mysql/

And now ungzip it and cd to the mysql sourcedir.

3) tar zxvf mysql-4.1.12.tar.gz

4) cd mysql-4.1.12

Now, we are going to configure the mysql using the default options.

5) ./configure –prefix=/usr/local/mysql

And now compile it.

6) make

Now install it.

7) make install

Now you need to copy the mysql conf file.

8) cp support-files/my-medium.cnf /etc/my.cnf

Now, we need to install the mysql database.

9) /usr/local/mysql/bin/mysql_install_db –user=mysql

And now chown it.

10)

chown -R root .
chown -R mysql var
chgrp -R mysql .

Okey, now we’re going to try to start the mysqld.

11) /usr/local/mysql/bin/mysqld_safe –user=mysql &

And to set mysql’s root password type this:

12) /usr/local/mysql/bin/mysqladmin -u root password “new-password”

——————-
PHP 4.3.11
——————-

Let’s download the latest version of PHP4.

1) wget http://ro2.php.net/get/php-4.4.0.tar.gz/from/ro.php.net/mirror

Let’s ungzip it and cd to the php dir.

2) tar zxvf php-4.4.0.tar.gz

3) cd php-4.3.11

Let’s configure it with using the most common options.

4) ./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-openssl –with-zlib –with-bz2 –enable-ftp –with-gd –with-jpeg –with-png –with-gettext –with-mime-magic –with-mysql=/usr/local/mysql –with-mysqli

And now compile it…

5) make

And after that, install it.

6) make install

Now were’ going to copy the php conf file

7) cp php.ini-dist /usr/local/lib/php.ini

And now add one line to httpd.conf

8) echo “AddType application/x-httpd-php .php” > /usr/local/apache2/conf/httpd.conf

And apache should be installed with PHP support

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress