First, installation-related dependencies:
Yum Install GCC GCC bzip2-devel libjpeg-devel libpng-devel freetype-devel
Second, unzip the PHP installation package php-5.6.22.tar.gz
tar -xzvf php-5.6. . tar. gz-c/usr/src/
Third, compile and install PHP
cd/usr/src/php-5.6. /./configure--prefix=/usr/local/php5.6/--with-config-file-path=/usr/local/php5.6/etc-- WITH-CONFIG-FILE-SCAN-DIR=/USR/LOCAL/PHP5.6/ETC/PHP.D--with-mysql=/usr/local/mysql/--with-openssl--with-mysqli =/usr/local/mysql/bin/mysql_config--enable-mbstring--enable-bcmath--with-freetype-dir--with-jpeg-dir-- With-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-apxs2=/usr/local/httpd/bin/ Apxs--with-bz2--enable-maintainer-zts--with-gd--with-gettext && make && make install
Iv. Check if PHP is installed as a httpd module
grep --color php
V. Copy the PHP configuration file
CP /usr/src/php-5.6. /php.ini-production/usr/local/php5.6/etc/php.ini
Vi. Modify the httpd configuration file to enable httpd to process PHP files
vim/usr/local/httpd/conf/http.conf/http Add addtype application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
Modify
DirectoryIndex index.php index.html
Seven, make a home file index.php to test whether PHP is installed successfully
mv /usr/local/httpd/htdocs/index.html/usr/local/httpd/htdocs//usr/local/httpd/htdocs/ index.phphead></head><body><? php phpinfo ();? ></body>
Eight. Start httpd and check if PHP page is active
Compiling and installing HPH