Install apache and php in linux. Read the installation of apache and php in linux. 1. download the source code package of apache forLinux on the following page. Command list: cd/ho
1. apache
Download the source code package of apache for Linux on the following page
;
Save to the/home/xx Directory. xx is a self-built folder. I created a wj folder.
Command list:
Cd/home/wj
Tar-zxvf httpd-2.0.54.tar.gz
Music 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
2. php
Download the php for Linux source code package on the following page
;
Save to/home/wj Directory
Command list:
Cd/home/wj
Tar-zxvf php-5.0.4.tar.gz
Music php-5.0.4 php
Cd php
. /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
Here, apache and mysql are changed based on the directory name you installed. my options are =/usr/local/apache2/bin/apxs and MySQL.
Cp php. ini-dist/usr/local/lib/php. ini
Install php in dso mode to/usr/local/php and set the configuration file directory to/usr/local/lib to enable mysql. xml supports
3. configuration
Vi/usr/local/apache/conf/httpd. conf
Configure apache as follows:
# Change the ServerAdmin line to your email address
# DocumentRoot "/home/httpd/html/" is the main 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 the default file name order of apache
# AddType application/x-httpd-php. php. phtml. php3. inc
# AddType application/x-httpd-php-source. phps
# Set the php file suffix
Save disk and exit
Vi/usr/local/lib/php. ini
# Register-golbals = On
Save disk and exit
4. start the service
/Usr/local/apache/bin/apachectl start
5. test
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 your Apche + Mysql + PHP installation.
6. apache automatic startup --
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. it must be executable.
# Chmod + x/etc/rc. d/init. d/apached // Set the file attributes to executable.
# Ln-s/etc/rc. d/init. d/apached/etc/rc3.d/S90apache // create a soft connection and a shortcut
# Ln-s/etc/rc. d/init. d/apached/etc/rc0.d/K20apache