You need to install Apache and MySQL before you install PHP.
(1), Download and PHP package and decompression
Cd/usr/local/srcwget Http://cn2.php.net/distributions/php-5.6.18.tar.gz/from/this/mirror-O Php-5.6.18.tar.gztar- ZXVF php-5.6.18.tar.gz
(2), installation of GCC and various compilation tools
Yum install make apr* autoconf automake gcc gcc-c++ zlib-devel OpenSSL openssl-devel pcre-devel gd kernel keyutils patch Perl kernel-headers compat* MPFR cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel li Bsepol-devel libselinux-devel krb5-devel zlib-devel libxpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* LIBXML2 libxml2-devel Patch
(3), configuration, compilation, installation
CD php-5.6.18./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache24/bin/apxs--with-config-file-path =/usr/local/php/etc--with-mysql=/usr/local/mysql--with-libxml-dir--with-gd--with-jpeg-dir--with-freetype-dir-- With-iconv-dir--with-zlib-dir--with-bz2--with-openssl--enable-soap--enable-gd-native-ttf--enable-mbstring-- Enable-sockets--enable-exif--with-curl--enable-json--disable-ipv6
If there is an error during the configuration of the compilation parameters, it may be that a development package is missing and can be made up, such as:
Error message:
Configure:error:freetype-config not found.
Workaround:
Yum Install Freetype-devel
With no errors, you can compile (make) and install (makes install).
Make && make install
(4), configuring php.ini and configuring Apache configuration Files httpd.conf
CP Php.ini-production/usr/local/php/etc/php.ini
Vim/usr/local/apache24/conf/httpd.conf
Found it:
AddType application/x-gzip. gz. tgz
Add to:
AddType application/x-httpd-php. php
Found it:
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>
Modify:
<ifmodule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
(5), restart the Apache server, test whether to parse PHP
/usr/local/apache24/bin/apachectl-k Restart vim/usr/local/apache24/htdocs/info.php Write the following code: <?php phpinfo ();? >
Test (if IP is: 192.168.1.110):
http://192.168.1.110/info.php
Reference: http://php.net/manual/zh/install.unix.apache2.php
This article is from the "Balich" blog, make sure to keep this source http://balich.blog.51cto.com/6641781/1743499
php5.6 Source Installation Process