Installation is similar on other Linux distributions. The tutorial below covers two approaches. The first discussed is downloading and installing packages. How to use Apache's DSO Module is discussed second.
This tutorial was written for the abstract versions. For complete information regarding installation, especially if there are new versions released, you should read the install notes for each of the packages.
This tutorial assumes you are running Linux and it is installed properly. For help with installing and configuring Linux check out some of the related links at the bottom of this page.
Download the Packages
First download the required packages to a directory. If you are running a different platform be sure to download the appropiate files for your platform:Extract the Apache and PHP package into that directory using
# tar xfz php_4.0.3pl1.tar.gz
Note: The pound sign # is the system prompt. You type in only what is after it .
Installing MySQL
MySQL is easiest to install on Red Hat systems using the RPM packages. To install MySQL in the same directory as the RPM packages use the command:Note: You most likely need to do this as the root user. Either log in or
su
to root. After MySQL is installed you need to set the root password. To do this use the following commanding changing my_password to the password you want for the root user to access MySQL.
Note: If the MySQL service is not running, you may have to start it by hand before trying to set the password. It should start automatically when the computer boots. The command to start MySQL is:
You can test the MySQL installation by doing the following:
# mysql mysql (connect to mysql database)
Enter Password:
mysql> SELECT * FROM user; (grab some data out of user table)
This should return the data in the user table. Type exit to leave.
Installing Apache with PHP
Apache with PHP can be installed a few different ways. One way is to statically embed the PHP binary into the Apache binary. This is probably the fastest and best way to run PHP. You can also install PHP as a DSO moduleHere are the step by step directions to install Apache and PHP in the directory /usr/local/apache
In Apache src directory (apache_1.3.14/)In PHP src directory (php-4.0.3pl1/)
--with-xml \
--enable-track-vars \
--with-apache=../apache_1.3.14 \
# make
# make install
In Apache src directory (apache_1.3.14)
--enable-module=rewrite \
--activate-module=src/modules/php4/libphp4.a
# make
# make install
This will install Apache in the /usr/local/apache directory. The only thing left to do is to configure them.
Configuring Apache and PHP
To configure PHP copy php.ini-dist which is in the PHP src directory to /usr/local/lib/php.ini Edit this file setting the options you wish, generally nothing needs to be edited. However, you can set various options such as a default MySQL username and password.
To configure Apache edit /usr/local/apache/conf/httpd.conf and set the your document directory and any other Apache settings you may want. To enable Apache and PHP to work together the following line needs to be added:
Look for this line or something similar already in the httpd.conf file and replace it with the above. Make sure to remove the # comment mark.
After editing the config file you need to restart Apache. The command to restart Apache is: