1.apache
Download the source code package of apache for Linux on the following page http://www.apache.org/dist/httpd/ ;
Save it to the /home/xx directory. xx is a self-created folder. I created a wj folder.
Command list:
cd /home/wj
tar -zxvf httpd-2.0.54.tar.gz
mv httpd-2.0.54 apache
cd apache
./configure --prefix=/usr/local/apache2 --enable-module=so
make
make install
Install apache to /usr/local/apache and configure apache to support dso mode 2.php
Download the source code package of php for Linux on the following page http://www.php.net/downloads.php ;
Save to /home/wj directory command list:
cd /home/wj
tar -zxvf php-5.0.4.tar.gz
mvphp-5.0.4php
cdphp
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/lib --enable-track -vars --with-xml --with-MySQL
make
make install
Among them, apache and mysql change according to the directory name you installed. Mine is =/usr/local/apache2/bin/apxs and MySQL.
cp php.ini-dist /usr/local/lib/php.ini
Install php to /usr/local/php in dso mode. Set the configuration file directory to /usr/local/lib and enable mysql and xml support.
3. Configure vi /usr/local/apache/conf/httpd.conf
Configure apache as follows #Change the ServerAdmin mailto:[email protected] line to your email address
#DocumentRoot "/home/httpd/html/" This is the home directory of the html file # Same as above #Options FollowSymLinks MultiViews For security reasons, Remove "Indexes"
#
# DirectoryIndex default.php default.phtml default.php3 default.html default.htm
#
#Set apache's default file name order #AddType application/x-httpd-php .php .phtml .php3 .inc
#AddType application/x-httpd-php-source .phps
#Set the php file suffix, save and exit vi /usr/local/lib/php.ini
#register-golbals = On
Save and exit 4. Start the service /usr/local/apache/bin/apachectl start
5. Test and then write a php test page info.php: the content is as follows〈?php
phpinfo();
?>
If it is normal, you should be able to see the php information. Congratulations on the successful installation of Apche+Mysql+PHP.
6. apache starts automatically - -
The following uses self-starting apache as an example;
Self-starting script:
/usr/local/apache/bin/apachectl start
The file is located under /etc/rc.d/init.d and is named apached. Note that it must be executable.
#chmod +x /etc/rc.d/init.d/apached //Set the file attribute to executable
#ln -s /etc/rc.d/init.d/apached /etc/rc3.d/S90apache //Establish soft connection, shortcut
#ln -s /etc/rc.d/init.d/apached /etc/rc0.d/K20apache