1. Download the source package
wget URL/php-5.6.30.tar.gz
2. Unzip the source package
TAR-ZXVF php-5.6.30.tar.gz
3. Create an installation directory
mkdir/usr/local/php
4, enter the extracted directory, initialize the installation environment:
./configure \
--prefix=/usr/local/php \
--WITH-APXS2=/USR/LOCAL/APACHE/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
Error
Configure:error:jpeglib.h not found.
[Email protected] php-5.6.30]#
Install Yum install-y libjpeg-devel
Error
Configure:error:mcrypt.h not found. Please
Reinstall Libmcrypt.
[Email protected] php-5.6.30]#
Install yum install-y epel-release libmcrypt-devel
5, compilation Yi: Make
6. Installation: Make install
/usr/local/php/bin/php-i viewing the relevant configuration
Copy the configuration file to the specified directory
/usr/local/apache2/bin/apachectl restart
The Apachectl service needs to be restarted because PHP is configured to change Apache
Copy Preparation/usr/local/src/php.../php.ini-production
To/usr/local/php/etc/php.ini
Modifying the Apache configuration file
Vi/usr/local/apache2/conf/httpd.conf
Add index.php after DirectoryIndex index.html
Description: Increase the index for PHP if a site default page is
index.php, then you have to add this index.php support.
Under AddType application/x-gzip. GZ tgz
Plus one line.
AddType application/x-httpd-php. php
Explanation: Support PHP script parsing, must add the corresponding type.
Found it:
#ServerName www.example.com:80
Modified to:
ServerName localhost:80
Check for problems with the configuration file:
/usr/local/apache2/bin/apachectl-t
/usr/local/apache2/bin/apachectl restart
The Apachectl service needs to be restarted because PHP is configured to change Apache
php5.6 Compiling and installing Apache