1, download the decompression Php,config
Tar zxvf php-xxxx./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-mysqlli=/ With-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-apxs2=/usr/ LOCAL/HTTPD/BIN/APXS # #把php添加成apache模块 # #--with-mcrypt # #支持加密 # #--WITH-CONFIG-FILE-PATH=/ETC-- WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2--enable-maintainer-zts
If you want to support fastcgi,
--with-apxs2=/usr/local/httpd/bin/apxs
Change into--ENABLE-FPM
Fix MCrypt look at an article, compile Error 2 times:
Yum install-y libxml2 Libxml2-devel
Yum install-y bzip2 bzip2-devel
Description
1. In order to support the two mpm of the Apache worker or event, the--ENABLE-MAINTAINER-ZTS option is used at compile time.
2, if you use PHP5.3 or above, in order to link the MySQL database, you can specify MYSQLND, so you do not need to install the MySQL or MySQL development package. MYSQLND is available from PHP 5.3 and can be bound to it at compile time (instead of relying on the specific MySQL client library bindings), but it is the default setting starting with PHP 5.4.
#./configure--with-mysql=mysqlnd--with-pdo-mysql=mysqlnd--with-mysqli=mysqlnd
2. Make&&make Install
Procedure omitted
3. Provide configuration files for PHP
There's php.ini-production in the PHP source package.
CP Php.ini-production/etc/php.ini
Edit Apache config file httpd.conf, let Apache support PHP
Vim/etc/httpd/httpd.conf
1, add the following two lines
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
2. Locate to DirectoryIndex index.html
Modified to:
DirectoryIndex index.php index.html
Restart httpd
Test PHP
<?phpphpinfo ();? >
Test if PHP is connected to MySQL properly
<?php$con=mysql_connect (' localhost ', ' root ', '), if ($con) echo "success."; else echo "failure ...";? >
Compiling and installing PHP