Linux compiled to upgrade php detailed method, there is the configuration of php. ini, configure the php-fpm.conf code. Environment: CentOS-5.4
Php upgrade: 5.4.14-5.5.0
Upgrade experience: relatively smooth, but one thing to note: eaccelerator is not compatible with php5.5.0. Fortunately, php provides Zend OPcache by default in 5.5.0, so friends who have been used to eaccelerator will upgrade to php5.5.0, it may be necessary to talk to the eaccelerator about bye temporarily.
1. install php5.5.0 Download php installation package: http://www.php.net/get/php-5.5.0.tar.gz/from/a/mirror
The code is as follows:
# Decompress the installation package
Tar zxvf php-5.5.0.tar.gz
Make ZEND_EXTRA_LIBS = 'liconv'
Make install
Cp php. ini-production/usr/local/webserver/php-d/php-5.5.0/etc/php. ini
Here are a few notes:
During installation, add or delete additional components as needed and modify the corresponding directory path.
Do not forget to match opcache:-enable-opcache during installation
The-enable-safe-mode option is added during php-5.3.10 compilation, but the php-5.4.0 has removed this option, which can be used during compilation. /configure-help | grep "safe-mode". no information is output, indicating that it is not supported!
Also available: '-enable-discard-path','-enable-fastcgi ','-enable-force-cgi-redirect ','-with-curlwrappers'
2. Compile and install the php5.5.0 extension module: Install imagick
To install this module, the server must support ImageMagick, which is irrelevant to php upgrade. This part is omitted. if you need this module, search for it.
: Http://pecl.php.net/package/imagick
The code is as follows:
Tar xvzf imagick-3.1.0RC2.tgz
Cd imagick-3.1.0RC2
/Usr/local/webserver/php-d/php-5.5.0/bin/phpize
Export PKG_CONFIG_PATH =/usr/local/lib/pkgconfig/
./Configure -- with-php-config =/usr/local/webserver/php-d/php-5.5.0/bin/php-config
Make
Make install
Note:
Avoid compatibility issues. use the latest version instead of versions earlier than 3.0.1.
If make: *** [imagick_file.lo] Error 1 is reported during installation, call pkgconfig
Modify the directory path based on your needs.
Install memcache:
To install this module, the server must support memcached, which is irrelevant to upgrading php. This part is omitted. if you need to install this module, search for it.
: Http://pecl.php.net/package/memcache
The code is as follows:
Tar xvzf memcache-3.0.tgz
Cd memcache-3.0.8
/Usr/local/webserver/php-d/php-5.5.0/bin/phpize
./Configure \
-- Enable-memcache \
-- With-php-config =/usr/local/webserver/php-d/php-5.5.0/bin/php-config
Make
Make install
Note: Please do not use 2.2.6 or earlier versions, not compatible
Install phpredis-master
To install this module, the server must support redis, which is irrelevant to the upgrade of php. if you need this module, search for it.
: Https://github.com/nicolasff/phpredis
The code is as follows:
Unzip master
Cd phpredis-master
/Usr/local/webserver/php-d/php-5.5.0/bin/phpize
./Configure \
-- Enable-redis \
-- With-php-config =/usr/local/webserver/php-d/php-5.5.0/bin/php-config
Make
Make install
So far, all required modules have been installed.
3. configure php. ini The code is as follows:
Vi/usr/local/webserver/php-d/php-5.5.0/etc/php. ini
Configure Zend OPcache
EAccelerator has always been used to providing php acceleration, but there are two problems:
The eAccelerator is currently not compatible with php5.5.0.
Conflict between eAccelerator and Zend Opcache
Fortunately, php5.5.0 provides Zend Opcache for php acceleration by default. the configuration method is as follows:
The code is as follows:
Zend_extension =/usr/local/webserver/php-d/php-5.5.0/lib/php/extensions/no-debug-non-zts-20121212/opcache. so
Above zend_extension path is opcache. so Path
Note: If opcache. so cannot be found in your php extension module, it indicates that the installation is not successful. please reinstall it.
4. configure php-fpm.conf The code is as follows:
Pid =/usr/local/webserver/php-d/php-5.5.0/var/run/php-fpm.pid
Error_log =/usr/local/webserver/php-d/php-5.5.0/logs/php-fpm.log
Log_level = notice
Emergency_restart_threshold = 10
Emergency_restart_interval = 60 s
Php_admin_value [sendmail_path] =/usr/sbin/sendmail-t-I-f jht2718@163.com
Php_flag [display_errors] = on
Note: modify the configuration file as needed.
5. modify the startup item: The code is as follows:
Cp/usr/local/webserver/php-d/php-5.5.0/bin/php/etc/init. d/php
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.