1. Download
Switch to the specified directory
Cd/usr/local/src
Download PHP
wget http://cn2.php.net/distributions/php-5.4.44.tar.gz
PHP official: http://www.php.net/downloads.php
Unzip
Tar zxf php-5.4. tar.gz.
2. Configuring compilation parameters
Errors that occur during compilation of parameters
Configure:error:xml2-config not found. Please check your LIBXML2 installation.
The solution is
Yum Install-y libxml2-devel
Configure:error:Cannot find OpenSSL ' s <evp.h>
Solutions
Yum Install-y OpenSSL Openssl-devel
Checking for BZIP2 in default path ... not found
Configure:error:Please Reinstall the BZIP2 distribution
Solutions
Yum install-y bzip2 Bzip2-devel
Configure:error:png.h not found.
Solutions
Yum install-y libpng Libpng-devel
Configure:error:freetype.h not found.
Solutions
Yum install-y FreeType Freetype-devel
Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
Solutions
Yum Install-y epel-release
Yum Install-y libmcrypt-devel
Configure:error:jpeglib.h not found.
Solutions
Yum Install Libjpeg-devel-y
Switch to this directory
CD php-5.4. -
Compile parameters
./Configure--with-apr=/usr/local/Apr--prefix=/usr/local/PHP--with-apxs2=/usr/local/apache2/bin/Apxs--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/MySQL--with-libxml-dir--with-GD--with-jpeg-dir--with-png-dir--with-freetype-dir--with-iconv-dir--with-zlib-dir--with-bz2--with-OpenSSL--with-MCrypt--enable-Soap--enable-gd-native-TTF--enable-mbstring--enable-Sockets--enable-EXIF--disable-ipv6
echo $?
Compile
Make
echo $?
Installation
Make install
echo $?
Copy PHP configuration file
CP Php.ini-production/usr/local/etc/php.ini
Modifying the Apache configuration file
Vim/usr/local/apache2/conf/httpd.conf
1. Found #ServerName www.example.com: theinstead of servername www.example.com: the2. Found:<directory/>Options followsymlinksallowoverride noneorder deny,allowdeny from All</Directory>instead:<directory/>Options followsymlinksallowoverride noneorder deny,allowallow from All</Directory>3. Find <ifmodule Dir_module>DirectoryIndex index.html</IfModule>instead<ifmodule dir_module>directoryindex index.html index.php</IfModule>4. Find AddType application/x-Compress. Z AddType Application/x-gzip. GZ tgz changed to AddType application/x-Compress. Z AddType Application/x-gzip. gz. tgz AddType Application/x-httpd-php. PHP5. Find # include Conf/extra/httpd-vhosts.conf change to include Conf/extra/httpd-vhosts.conf
Modifying a configuration file
Vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
Mkdir/data/www
change the bottom two paragraph to <virtualhost *: > "/data/www" ServerName www.wangshaojun.com Serveralias www.denny.com "logs/dummy-host.example.com-error_log" "Logs/dummy-host.example.com-access_log" Common </VirtualHost>
See if there is a problem with the configuration file
/usr/local/apache2/bin/apachectl-t
Show syntax OK to configure no problem, then start the service
/usr/local/apache2/bin/apachectl start
See if there are any processes
PS aux |grep httpd
LAMP 1.4 PHP Compilation installation