The first is the compilation preparation:
Yum Groupinstall "Development tools"
Then it is the devel package that will be used to compile and install PHP 5.5.x:
Yum install libxml2-devel gd-devel libmcrypt-devel libcurl-devel openssl-devel
From the official download, unzip:
wget HTTP://US3.PHP.NET/GET/PHP-5.5.5.TAR.GZ/FROM/CN2.PHP.NET/MIRRORTAR-XVF PHP-5.5.5.TAR.GZCD php-5.5.5
Compile the parameters for installing PHP 5.5:
./configure--with-apxs2=/usr/local/apache2/bin/apxs--disable-cli--enable-shared--with-libxml-dir--WITH-GD-- With-openssl--enable-mbstring--with-mcrypt--with-mysqli--with-mysql--enable-opcache--enable-mysqlnd-- Enable-zip--with-zlib-dir--with-pdo-mysql--with-jpeg-dir--with-freetype-dir--with-curl--without-pdo-sqlite-- Without-sqlite3
I have tried to simplify the parameters, with the above parameters to compile the installation of PHP run WordPress, Joomla, IP board and other common blog, forum procedures are no problem, because there is--disable-cli, so it is impossible to make test, install good Can not php-v in the future. Install it:
Makemake INSTALLCP php.ini-production/usr/local/lib/php.ini# Remember the position of the above php.ini Oh.
As Apache, prepare Apache
It's time for Apache to know that PHP is there and add it in Apache config file httpd.conf:
LoadModule Php5_module modules/libphp5.so# The above line may have been automatically added by the system during the compilation and installation of PHP <filesmatch \.php$>sethandler Application/x-httpd-php</filesmatch>
Ok! Restarting Apache, a person with good character will not have problems.
If NIGNX, prepare nignx
Cp/etc/nginx/conf.d/default.conf/etc/nginx/conf.d/default.confbak #备份原有配置文件vi/etc/nginx/conf.d/default.conf #编辑
index index.php index.html index.htm; #增加index. PHP
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
Location ~ \.php$ {root Html;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param script_filename $ Document_root$fastcgi_script_name;include Fastcgi_params;}
#取消FastCGI the comment for the server section location, and note the parameters of the Fastcgi_param row, change to $document_root$fastcgi_script_name, or use the absolute path
Service nginx Restart #重启nginx
CentOS Compile and install php5.5, and formulate support APACH,NIGNX core code