1. Install MySQL
# Useradd mysql-S/sbin/nologin
# Tar zxvf mysql-5.0.90.tar.gz
# Cd mysql-5.0.90
#. /Configure -- prefix =/usr/local/MySQL localstatedir =/usr/local/MySQL/date -- enable-local-infile -- With-charset-GBK -- With-extra-charsets = all -- With-low-memory -- With-mysqld-user = MySQL -- enable-thread-safe-Client
# Make & make install // compile + install
# Cp support-files/my-large.cnf/etc/My. CNF
#/Usr/local/MySQL/bin/mysql_install_db -- defaults-file =/etc/My. CNF -- user = MySQL // initialize MySQL
# Chown-r root/usr/local/MySQL
# Chown-r MySQL/usr/local/MySQL/date
# Chgrp-r MySQL/usr/local/MySQL
#/Usr/local/MySQL/bin/mysqld_safe -- user = MySQL &
#/Usr/local/MySQL/bin/mysqladmin-uroot password 123456 // set the MySQL administrator password
CP support-files/MySQL. Server/etc/init. d/mysqld
Chmod 700/etc/init. d/mysqld
Chkconfig -- add mysqld
Chkconfig -- level 345 mysqld on
Install mysql-devel:
# Rpm-IVH MySQL-devel-5.0.90-1.i386.rpm
Install zlib libpng JPEG FreeType fontconfig GD
Yum install zlib libpng unzip SRC unzip Src-devel FreeType-devel fontconfig-devel Gd-devel
Ii. install Apache
# Tar jxvf httpd-2.2.13.tar.bz2
# Cd httpd-2.2.13
#. /Configure -- prefix =/usr/local/Apache -- enable-so -- enable-Rewrite -- enable-SSL -- With-SSL =/usr/bin/OpenSSL -- With-zlib -- enable -mod-shared = all -- enable-track-vars -- With-mysql =/usr/local/MySQL
# Make & make install
#/Usr/local/Apache/bin/apachectl start // start Apache
# Echo "/usr/local/Apache/bin/apachectl start">/etc/rc. Local // Add to start
3. install PHP
# Tar jxvf php-5.2.13.tar.bz2
# Cd php-5.2.13
#. /Configure -- prefix =/usr/local/PHP -- With-config-file-Path =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- enable-FastCGI -- With-zlib -- with-bz2 -- With-FreeType-dir -- enable-mbstring -- With-mysql =/usr/local/MySQL -- With-mysqli =/usr/local/ mySQL/bin/mysql_config -- With-Gd -- With-libxml-dir -- With-PNG-dir -- With-JPEG-dir -- enable-sockets -- With-PDO-mysql =/usr /local/MySQL
# Make & make install
# Ln-S/usr/local/PHP/bin/*/usr/local/bin/
# Cp PHP. ini-Dist/usr/local/PHP. ini
Create a PHP test page:
VI/usr/local/Apache/htdocs/index. php
<? PHP
Phpinfo ();
?>
Integrate Apache and PHP
# Vi/usr/local/Apache/CONF/httpd. conf
① Check whether the PHP module is added. As long as we allow Apache to dynamically load modules before installing Apache, the module will be automatically added. If this option is not found in the configuration file, please add it manually, about 53 rows
Loadmodule php5_module modules/libphp5.so
② Add support for PHP files. Add the following content under row 310 (under addtype application/X-gzip. GZ. tgz)
Addtype application/X-httpd-PHP. php
Addtype application/X-httpd-PHP-source. PHPs
③ Modify the default home page 167
Directoryindex index. php index.html
/Usr/local/Apache/bin/apachectl stop
/Usr/local/Apache/bin/apachectl start
Visit the phpinfo test page for testing!