Upgrade php5.2 to php5.4 full record under CentOS (Compile and install), php5.2php5.4
Upgrade
At present, although the latest version of PHP is php5.5, but for various considerations, or first to php5.4 more reliable.
The original PHP used is php5.2.10, has been running for 4-5 years, it is time to upgrade.
5.4 The latest stable version is 5.4.21 (5.4.22 2013 released ...)
Copy the Code code as follows:
wget Http://cn2.php.net/get/php-5.4.21.tar.gz/from/this/mirror
Tar zxf php-5.4.21.tar.gz
CD php-5.4.21
Modify the source code, if the program code is UTF-8, skip this step.
If your program is GBK by default, and there are many programs that use Htmlspecialchars, it is recommended to modify the source code directly, because 5.4 defaults to utf-8. The htmlspecialchars output will be empty.
Copy CodeThe code is as follows:
Ext/standard/html.c
Line 372
/* Default is now UTF-8 */
if (Charset_hint = = NULL)
return cs_utf_8;
--->
/* Default is now UTF-8 */
if (Charset_hint = = NULL)
return cs_8859_1;
Resolves an issue with htmlspecialchars default UTF-8.
Copy CodeThe code is as follows:
./configure--prefix=/usr/local/php5.4--with-zlib--enable-bcmath--with-curl--with-curlwrappers--enable-mbregex- -enable-mbstring--with-gd--enable-gd-native-ttf--with-openssl--with-mhash--enable-sockets--with-xmlrpc-- Enable-zip--enable-soap--without-pear--with-mysql--with-mysqli--with-pdo-mysql--enable-ftp--with-jpeg-dir-- With-freetype-dir--with-png-dir--enable-fpm--with-fpm-user=www--with-fpm-group=www
More streamlined installation parameters:
Copy CodeThe code is as follows:
./configure--prefix=/usr/local/php5.4--ENABLE-FPM--with-mysql
Make zend_extra_libs= '-liconv '
Make install
-----------------------
Move the two default files to the correct place, php.ini-development or php.ini-production to see the situation.
Copy CodeThe code is as follows:
cd/usr/local/php5.4/etc/
CP Php-fpm.conf.default php-fpm.conf
Cp/www/soft/php-5.4.21/php.ini-development/usr/local/php5.4/lib/php.ini
------------------------------
In php-fpm.conf
Listen.allowed_clients = 127.0.0.1 in front of; remove
---------------------
In php.ini
Copy the Code code as follows:
Short_open_tag = Off
Switch
Copy the Code code as follows:
Short_open_tag = On
Copy the Code code as follows:
;d Ate.timezone =
Switch
Copy the Code code as follows:
Date.timezone = "Asia/shanghai"
Copy the Code code as follows:
error_reporting = E_all
Switch
Copy the Code code as follows:
error_reporting = E_all & ~e_notice
Add to boot service list
Copy CodeThe code is as follows:
Cp-f/WWW/SOFT/PHP-5.4.21/SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM
chmod 755/etc/init.d/php-fpm
Chkconfig--add PHP-FPM
Chkconfig PHP-FPM on
Start PHP-FPM:
Copy CodeThe code is as follows:
Service PHP-FPM Start
PHP Upgrade complete!
------------------------------------------------------
Install Zendopcache, according to maintainer Laruence said, Zend Opcache, it is an extended form of PHP Optmizer, will do a lot of compilation optimization, there is no compatibility issues. More than 7% faster than APC. However, it does not provide apc_store user data cache. To use APC's user cache, consider using APCU or laruence Yac together.
Copy CodeThe code is as follows:
wget Http://pecl.php.net/get/ZendOpcache
Tar zxf Zendopcache
CD ZENDOPCACHE-7.0.2/
/usr/local/php5.4/bin/phpize
./configure--with-php-config=/usr/local/php5.4/bin/php-config
Make
Make install
Installing Shared extensions:/usr/local/php5.4/lib/php/extensions/no-debug-non-zts-20100525/
PHP.ini directly added to the bottom, the official recommended parameters
Copy CodeThe code is as follows:
zend_extension=/usr/local/php5.4/lib/php/extensions/no-debug-non-zts-20100525/opcache.so
opcache.memory_consumption=128
Opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
Opcache.revalidate_freq=60
Opcache.fast_shutdown=1
Opcache.enable_cli=1
Opcache.save_comments=0
Opcache.enable_file_override=1
Service PHP-FPM Reload
Here Phpinfo () has with Zend Opcache v7.0.2, and a lot of relevant parameters.
This php5.4 even if the upgrade is finished.
--------------------------------
Errors that may be encountered:
Failed to start PHP-FPM
Copy the Code code as follows:
Starting Php-fpm/etc/init.d/php-fpm:line 53:12483 Segmentation fault $php _fpm_bin--daemonize $php _opts
Failed
At the same time the installation of APC and Zend Opcache lead to conflict, with Zend Opcache, you can not install APC.
http://www.bkjia.com/PHPjc/978730.html www.bkjia.com true http://www.bkjia.com/PHPjc/978730.html techarticle CentOS upgrade php5.2 to php5.4 full record (compile and install), php5.2php5.4 upgrade currently the latest version of PHP although is php5.5, but for various considerations, or first to php5.4 more reliable. The original ...