Compiling and installing PHP
http://php.net/
[[email protected] ~]# ls
Anaconda-ks.cfg Install.log Install.log.syslog php-5.6.24.tar.bz2
[Email protected] php-5.6.24]# yum-y install libxm*
Fix MCrypt encryption issue requires installation of 4 packages Mhash and Mhash-devel and Libmcrpt-devel and Libmcrpt
http://www.rpmfind.net/install with Yum after download
./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-mysqli=/usr/local/mysql/ Bin/mysql_config--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir= /usr--enable-xml--enable-sockets--with-apxs2=/usr/local/apache/bin/apxs--with-mcrypt--with-config-file-path=/ etc--WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2--enable-maintainer-zts
#--prefix Specify the installation path
#--with-mysql specify where MySQL is
#--with-openssl supports OpenSSL feature
#--with-mysqli interface for PHP and MySQL interaction
#--enable-mbstring Open mbstring, support Chinese
#--with-freetype-dir supports FreeType features, referencing specific fonts.
#--with-jpeg-dir Support Images
#--with-png-dir Support Images
#--with-zlib Compression library, let data file compression and decompression, save bandwidth
#--with-libxml-dir XML Extension Markup Language, specifying where the path to the XML library is
#--enable-xml Open XML function
#--enable-sockets allows PHP to support socket-based communication
#--WITH-APXS2 compiles/usr/local/apache/bin/apxs into Apache module. Change to--ENABLE-FPM then use fastcgi
#--with-mcrypt supports encryption function
#--with-config-file-path The main configuration file location of PHP
#--with-config-file-scan-dir The location of the primary profile's fragment storage
#--WITH-BZ2 Compression Library
#--enable-maintainer-zts This is not required if Apache is using prefork, it must be started if Apache needs to work as a thread
Make
Make install
[[email protected] php-5.6.24]# CP php.ini-production/etc/php.ini Copy a configuration file to PHP
[Email protected] php-5.6.24]# vim/etc/httpd/httpd.conf
# If The addencoding directives above is commented-out, then you
# Probably should define those extensions to indicate media types:
#
AddType application/x-compress. Z
AddType application/x-gzip. gz. tgz
AddType application/x-httpd-php. PHP Add this line
AddType application/x-httpd-php-source. Phps PHP Source code
------------------------------------------------------
# directoryindex:sets The file that Apache would serve if a directory
# is requested.
#
<ifmodule dir_module>
DirectoryIndex index.php index.html Increase index.php
</IfModule>
-------------------------------
[[email protected] bin]#./apachectl Start httpd Service
[Email protected] htdocs]# mv index.html index.php
[Email protected] htdocs]# vim index.php
<?php
Phpinfo ();
?>
At this point, you can test PHP from the PC side
----------------------
<?php
$conn =mysql_connect (' localhost ', ' root ', ');
if ($conn)
echo "Success.";
Else
echo "Failure ..."
?>
Test database
--------------------
This article from "Operation and maintenance Growth Road" blog, declined reprint!
Compiling and installing PHP