1. install Apache
Download apache (http://httpd.apache.org/) to tmp
Unzip, tar-zxvf httpd-2.2.6.tar.gz
Cd httpd-2.2.6
Mkdir/usr/local/apache2
./Configure -- prefix =/usr/local/apache2 -- enable-so -- enable-mod-shared = all -- enable-rewrite -- enable-cache
Make
Make install
After installing apache, enter the command #/usr/local/apache2/bin/apachectl-k start
Start Apache
Service httpd start
Ii. Install Mysql
Download mysql RPM (service and client) Here ),
MySQL-server-community-5.1.51-1.rhel5.i386.rpm Installation server
MySQL-client-community-5.1.51-1.rhel5.i386.rpm installation Client
MySQL-devel-community-5.1.51-1.rhel5.i386.rpm for mysql installation in php
Rpm-ivh MySQL-server-community-5.1.51-1.rhel5.i386.rpm
Rpm-ivh MySQL-client-community-5.1.51-1.rhel5.i386.rpm
Rpm-ivh MySQL-devel-community-5.1.51-1.rhel5.i386.rpm
3. Install the tar package prepared by PHP
Before installing php, prepare:
Curl-7.15.0.tar.gz
Freetype-2.3.5.tar.gz
Gd-2.0.35.tar.gz
Gettext-0.16.1.tar.gz
Jpegsrc.v6b.tar.gz
Libpng-1.2.31.tar.bz2
Libxml2-2.6.31.tar.gz
T1lib-5.0.0.tar.gz
Tiff-3.8.2.tar.gz
Zlib-1.2.3.tar.gz
3.1 install curl-7.15.0.tar.gz
# Tar zxvf curl-7.15.0.tar.gz
# Cdcurl-7.15.0
# Mkdir/usr/local/crul
#./Configure -- prefix =/usr/local/curl
# Make clean
# Make
# Make install
3.2 listen src.v6b.tar.gz
# Mkdir-pv/usr/local/jpeg/{, bin, lib, include, man/man1, man1}
#./Configure -- prefix =/usr/local/jpeg -- enable-shared -- enable-static
# Make clean
# Make
# Make install
3.3 libxml2-2.6.31.tar.gz
# Tar zxvf libxml2-2.6.31.tar.gz
# Cd libxml2
# Mkdir usr/local/libxml2
#./Configure -- prefix =/usr/local/libxml2
# Make clean
# Make (time may be a little longer)
# Make install
# Cp xml2-config/usr/bin
3.4 PDFlib-7.0.3-Linux-php.tar.gz
# Tar xvf PDFlib-7.0.3-Linux-php.tar.gz
# Cd pdflib
# Cp bind/php5/php520mt/libpdf-php.so/usr/local/lib/
(Php503, php510, and php520 directories are in the same level in the above php520mt directory. I don't know if it is the version difference)
3.5 t1lib-5.0.0.tar.gz
# Tar zxvf t1lib-5.0.0.tar.gz
# Cd t1lib
# Mkdir/usr/local/t1lib
#./Configure -- prefix =/usr/local/t1lib
# Make without-doc
# Make install
3.6 freetype-2.3.5.tar.gz
# Tar zxvf freetype-2.3.5.tar.gz
# Cd freetype
# Mkdir/usr/local/freetype
#./Configure -- prefix =/usr/local/freetype
# Make clean
# Make
# Make install
3.7 zlib-1.2.3.tar.gz
# Tar zxvf zlib-1.2.3.tar.gz
# Cd zlib-1.2.3
#./Configure -- shared
# Make clean
# Make
# Make install
3.8 libpng-1.2.26.tar.gz
# Tar zxvf libpng-1.2.26.tar.gz
# Cd libpng
# Cp scripts/makefile. linux./makefile
# Mkdir/usr/local/libpng
#./Configure -- prefix =/usr/local/libpng
# Make clean
# Make
# Make install
3.9 gettext-0.16.tar.gz
# Tar zxvf gettext-0.16.tar.gz
# Cd gettext
# Mkdir/usr/local/gettext
#./Configure -- prefix =/usr/local/gettext
# Make clean
# Make
# Make install (a little longer)
3.10 gd-2.0.35.tar.gz
# Tar zxvf gd-2.0.35.tar.gz
# Cd gd
#. /Configure -- with-png =/usr/local/lib -- with-zlib =/usr/local/lib -- with-freetype =/usr/local/freetype/lib --- jpeg =/usr/local/jpeg/lib
# Make clean
# Make
# Make install 4. install PHP
Download php-5.2.14
Tar gxvf php-5.2.14.tar.bz2
Cd php-5.2.14
. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- enable-track-vars -- with-sockets -- enable-sockets -- -sysvshm -- with-sysvsem -- with-pdflib-dir =/usr/local/lib -- with-jpeg-dir =/usr/local/jpeg -- with-png-dir =/ usr/local/lib -- enable-mbstring = all -- with-zlib-dir =/usr/local/lib -- with-freetype-dir =/usr/local/freetype --- curl =/usr/local/curl -- with-libxml-dir =/usr/local/libxml2/lib -- with-gettext =/usr/local/gettext/lib -- with-gd -- with-mysql =/usr -- with-mysqli =/usr/bin/mysql_config
# Make clean
# Make
# Make test
# Make install
Php. INI File Modification
# Cp php. ini-production/usr/local/lib/php. ini
# Vi/usr/local/lib/php. ini
Find the content for modifying extension_dir =./(as follows)
Extension_dir =/usr/local/lib
Add the PHP environment variable:
Temporary # export PATH = $ PATH:/usr/local/php/bin
Permanent: There is a profile file under/etc. Open it and set "export PATH = $ PATH: put the/usr/local/php/bin Statement on the line "export path user logname mail hostname histsize inputrc ".
The environment configuration takes effect immediately without restarting. Run the following command:
./Etc/profile
5. Modify the apache configuration file httpd. conf.
# Vi/usr/local/apache2/conf/httpd. conf
Find AddType in DefaultType text/plain
<IfModule mime_module>
Enter the following content:
AddType application/x-httpd-php. htm
AddType application/x-httpd-php. html
AddType application/x-httpd-php. phtml
AddType application/x-httpd-php. php
(Do you have to enter so many items)
Find DirectoryIndex index.html and enter index. php
Make sure that the following two rows are configured:
LoadModule php5_module modules/libphp5.so
LoadModule rewrite_module modules/mod_rewrite.so
Save the file and exit.