


Full record of upgrading php5.2 to php5.4 under Centos (compile and install), php5.2php5.4
Upgrade
Although the latest version of php is currently php5.5, due to various considerations, it is more reliable to upgrade to php5.4 first.
The original PHP uses php5.2.10, which has been running for 4 to 5 years. It is time to upgrade.
The latest stable version of 5.4 is 5.4.21 (5.4.22 was released on 14 Nov 2013...)
Copy code The code is 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 encoding is UTF-8, skip this step.
If your program defaults to GBK, and many of the programs use htmlspecialchars, it is recommended to modify the source code directly, because 5.4 defaults to utf-8. The output using htmlspecialchars will be empty.
Copy code The 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;
Solve the problem of htmlspecialchars defaulting to UTF-8.
Copy code The 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
Simpler installation parameters:
Copy code The 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 location, php.ini-development or php.ini-production as appropriate.
Copy code The 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
----------------------------------
php-fpm.conf
listen.allowed_clients = 127.0.0.1; remove
--------------------------
php.ini
Copy code The code is as follows:
short_open_tag = Off
Change to
Copy code The code is as follows:
short_open_tag = On
Copy code The code is as follows:
;date.timezone =
Change to
Copy code The code is as follows:
date.timezone = "Asia/Shanghai"
Copy code The code is as follows:
error_reporting = E_ALL
Change to
Copy code The code is as follows:
error_reporting = E_ALL & ~E_NOTICE
Add to boot service list
Copy code The 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 code The code is as follows:
service php-fpm start
PHP upgrade completed!
-------------------------------------------------- ----
Install ZendOpcache. According to maintainer Laruence, Zend Opcache, which is an Optmizer for PHP provided in an extended form, will also do a lot of compilation optimization and has no compatibility issues. Compared with APC, it is more than 7% faster. But it The apc_store user data cache is not provided. If you want to use apc's user cache, you can consider using APCU or Laruence's Yac together.
Copy code The 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/
Add it directly to the bottom of php.ini, official recommended parameters
Copy code The 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
There is with Zend OPcache v7.0.2 in phpinfo() here, as well as many related parameters.
In this way, php5.4 will be upgraded.
--------------------------------
Errors you may encounter:
Failed to start php-fpm
Copy code The code is as follows:
Starting php-fpm /etc/init.d/php-fpm: line 53: 12483 Segmentation fault $php_fpm_BIN --daemonize $php_opts
failed
Installing APC and Zend opcache at the same time will cause conflicts. With Zend opcache, there is no need to install APC.

查版本号的命令:1、“cat /etc/issue”或“cat /etc/redhat-release”,可输出centos版本号;2、“cat /proc/version”、“uname -a”或“uname -r”,可输出内核版本号。

centos重启网卡的方法:1、对于centos6的网卡重启命令是“service network restart”;2、对于centos7的网卡重启命令是“systemctl restart network”。

centos php安装opcache的方法:1、执行“yum list php73* | grep opcache”命令;2、通过“yum install php73-php-opcache.x86_64”安装opcache;3、使用“find / -name opcache.so”查找“opcache.so”的位置并将其移动到php的扩展目录即可。

centos离线安装mysql的方法:1、将lib中的所有依赖上传到linux中,并用yum命令进行安装;2、解压MySQL并把文件复制到想要安装的目录;3、修改my.cnf配置文件;4、复制启动脚本到资源目录并修改启动脚本;5、将mysqld服务加入到系统服务里面;6、将mysql客户端配置到环境变量中,并使配置生效即可。

centos删除php的方法:1、通过“#rpm -qa|grep php”命令查看全部php软件包;2、通过“rpm -e”命令卸载相应的依赖项;3、重新使用“php -v”命令查看版本信息即可。

centos7安装不出现界面的解决办法:1、选择“Install CentOS 7”,按“e”进入启动引导界面;2、 将“inst.stage2=hd:LABEL=CentOS\x207\x20x86_64”改为“linux dd”;3、重新进入“Install CentOS 7”,按“e”将“hd:”后的字符替换成“/dev/sdd4”,然后按“Ctrl+x”执行即可。

方法:1、利用“vim ~/.bashrc”编辑用户目录(~)下的“.bashrc”文件;2、在文件内添加“alias ls="ls --color"”;3、利用“:wq!”命令保存文件内的更改;4、“exit”命令退出终端后重新连接即可。

我们的PC中有一个磁盘驱动器专门用于所有与Windows操作系统相关的安装。该驱动器通常是C驱动器。如果您还在PC的C盘上安装了最新的Windows11操作系统,那么所有系统更新(很可能是您安装的所有软件)都会将其所有文件存储在C盘中。因此,保持此驱动器没有垃圾文件并在C驱动器中拥有足够的存储空间变得非常重要,因为该驱动器拥有的空间越多,您的Windows11操作系统运行起来就越顺畅。但是您可以在磁盘驱动器上增加多少空间以及可以删除多少文件是有限制的。在这种情况下,


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.