Home  >  Article  >  Backend Development  >  Detailed graphic explanation on how to smoothly upgrade PHP

Detailed graphic explanation on how to smoothly upgrade PHP

藏色散人
藏色散人forward
2022-01-22 16:00:256517browse

php smooth upgrade

1.既然是平滑升级,是不需要宕机,也不需要停止服务,是不存在关闭网站的说法
2.而升级最后的重启,重启的是PHP加载的配置文件,不影响你当前运行的网站
3.php-fpm是属于FastCgi,一旦启动是在内存中跑的,和你编译升级的过程没有任何关系

System: centos6.8
php environment: php5.3.29
Upgrade version: php5.4.45
Download php address: http:// www.php.net/distributi...
Copy the php5.3.29 installation directory config.nice to php-5.4.25
[root@localhost php-5.4.45]# cp /php-5.3.29 /config.nice /usr/local/src/php-5.4.45
[root@localhost php-5.4.45]# cd php-5.4.45/
[root@localhost php-5.4.45] # ./config.nice
[root@localhost php-5.4.45]# make ZEND_EXTRA_LIBS='-liconv'
[root@localhost php-5.4.45]# make install

Upgrade After completion, it is recommended to execute the command:

You may want to add: /usr/local/php5/lib/php to your php.ini include_path
/usr/local/src/php-5.4.45/build/shtool install -c ext/phar/phar.phar /usr/local/php5/bin
ln -s -f /usr/local/php5/bin/phar.phar /usr/local/php5/bin/phar
Installing PDO headers:          /usr/local/php5/include/php/ext/pdo/

You may encounter errors during installation

Detailed graphic explanation on how to smoothly upgrade PHP

## Reason: If "undefined reference to libiconv_open" occurs when installing PHP into the system '" and other error messages, it means that some environment variable values ​​​​are not captured properly in "./configure". The error occurred when creating "-o sapi/cli/php", and the iconv library parameter to be linked was not given.

The first solution: edit the Makefile around line 77: EXTRA_LIBS = ..... -lcrypt and add -liconv at the end, for example: EXTRA_LIBS = ..... -lcrypt -liconv and then try again Just make.
Second solution:
make ZEND_EXTRA_LIBS='-liconv'
ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/

curl upgrade

Situation Description: curl uses yum to install the SSL version as NSS by default, and existing projects need to support OpenSSL.

Current curl version

Detailed graphic explanation on how to smoothly upgrade PHP

phpinfo output information

Detailed graphic explanation on how to smoothly upgrade PHP

Download the latest curl: https://curl.haxx.se/download/curl-7.54.1.tar.gz

Start upgrading:

[root@IM-web-03 html]# rpm -qa |grep curl
libcurl-devel-7.19.7-53.el6_9.x86_64
curl-7.19.7-53.el6_9.x86_64
libcurl-7.19.7-53.el6_9.x86_64
python-pycurl-7.19.0-9.el6.x86_64
[root@IM-web-03 html]# rpm -e curl-7.19.7-53.el6_9.x86_64 --nodeps
[root@IM-web-03 ~]# tar xvf curl-7.54.1.tar.gz
[root@IM-web-03 ~]# cd curl-7.54.1
[root@IM-web-03 curl-7.54.1]# ./configure  --prefix=/usr/local/curl --without-nss --with-ssl  #关闭NSS 开启OpenSSL
[root@IM-web-03 curl-7.54.1]# make
[root@IM-web-03 curl-7.54.1]# make install
[root@IM-web-03 curl-7.54.1]# rm -rf /usr/lib64/libcurl.so.4*                        #删除原有的动态库
[root@IM-web-03 curl-7.54.1]# ln -s /usr/local/curl/lib/libcurl.so.4* /usr/lib64/    #将新动态库放到对应位置
[root@IM-web-03 curl-7.54.1]# ldconfig                                               #刷新动态库
[root@IM-web-03 ~]# cd php-5.3.29/ext/curl/
[root@IM-web-03 curl]# /usr/local/php5/bin/phpize
[root@IM-web-03 curl]# ./configure --with-curl=/usr/local/curl/ --with-php-config=/usr/local/php5/bin/php-config
[root@IM-web-03 curl]# make
[root@IM-web-03 curl]# make install
[root@IM-web-03 curl]# vim /usr/local/php5/etc/php.ini
添加:extension="/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/curl.so"
[root@IM-web-03 curl]# /etc/init.d/php-fpm restart

Check the version curl and PHPinfo version information after upgrading

Detailed graphic explanation on how to smoothly upgrade PHP

Detailed graphic explanation on how to smoothly upgrade PHP

##Recommended study: "
PHP video tutorial

The above is the detailed content of Detailed graphic explanation on how to smoothly upgrade PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete