<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP 5.4 &#8211; 编码无悔 /  Intent &amp; Focused</title>
	<atom:link href="https://www.codelast.com/tag/php-5-4/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codelast.com</link>
	<description>最优化之路</description>
	<lastBuildDate>Fri, 03 Jul 2020 16:24:31 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[原创] PHP 5.4 升级到 7.0</title>
		<link>https://www.codelast.com/%e5%8e%9f%e5%88%9b-php-5-4-%e5%8d%87%e7%ba%a7%e5%88%b0-7-0/</link>
					<comments>https://www.codelast.com/%e5%8e%9f%e5%88%9b-php-5-4-%e5%8d%87%e7%ba%a7%e5%88%b0-7-0/#respond</comments>
		
		<dc:creator><![CDATA[learnhard]]></dc:creator>
		<pubDate>Fri, 03 Jul 2020 08:27:51 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[原创]]></category>
		<category><![CDATA[综合]]></category>
		<category><![CDATA[PHP 5.4]]></category>
		<category><![CDATA[PHP 7.0]]></category>
		<category><![CDATA[升级]]></category>
		<guid isPermaLink="false">https://www.codelast.com/?p=12674</guid>

					<description><![CDATA[<p><span style="color: rgb(0, 0, 255);">✔</span>&#160;为什么要升级PHP版本<br />
WordPress版本升级，已经不支持5.4了，必须要升到7.x，就这一条理由就不得不面对现实。再说了，PHP 5.4是多么老旧的上古化石版本啊！<br />
以下步骤只适用于CentOS 7系统（具体子版本不确定能支持到什么范围）。</p>
<div>
	<br />
	<span style="color: rgb(0, 0, 255);">✔</span>&#160;怎样升级PHP版本最方便<br />
	对我来说，原来的PHP是通过yum install安装的，因此，如果能通过yum来把旧版升级到新版，是最方便的了。源码编译什么的，那得多烦啊！<br />
	<span id="more-12674"></span></div>
<div>
	<span style="color: rgb(0, 0, 255);">✔</span>&#160;确定CentOS版本</div>
<div>
	<span style="color:#0000ff;">cat /etc/redhat-release</span></div>
<div>
	&#160;</div>
<div>
	<span style="color: rgb(0, 0, 255);">✔</span>&#160;安装EPEL</div>
<div>
	<span style="color:#0000ff;">yum -y install epel-release</span></div>
<div>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a></div>
<div>
	<span style="color: rgb(0, 0, 255);">✔</span>&#160;安装php7的yum源</div>
<div>
	<span style="color:#0000ff;">rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm</span></div>
<div>
	<span style="color:#0000ff;">rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm</span></div>
<div>
	&#160;</div>
<div>
	<span style="color: rgb(0, 0, 255);">✔</span>&#160;安装remi的centos7的源</div>
<div>
	<span style="color:#0000ff;">rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm</span></div>
<div>
	&#160;</div>
<div>
	<span style="color: rgb(0, 0, 255);">✔</span>&#160;查看已经安装过的PHP包</div>
<div>
	<span style="color:#0000ff;">yum list installed &#124; grep php</span></div>
<div>
	<span style="color:#b22222;">php.x86_64&#160;</span></div>&#8230; <a href="https://www.codelast.com/%e5%8e%9f%e5%88%9b-php-5-4-%e5%8d%87%e7%ba%a7%e5%88%b0-7-0/" class="read-more">Read More </a>]]></description>
										<content:encoded><![CDATA[<p><span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;为什么要升级PHP版本<br />
WordPress版本升级，已经不支持5.4了，必须要升到7.x，就这一条理由就不得不面对现实。再说了，PHP 5.4是多么老旧的上古化石版本啊！<br />
以下步骤只适用于CentOS 7系统（具体子版本不确定能支持到什么范围）。</p>
<div>
	<br />
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;怎样升级PHP版本最方便<br />
	对我来说，原来的PHP是通过yum install安装的，因此，如果能通过yum来把旧版升级到新版，是最方便的了。源码编译什么的，那得多烦啊！<br />
	<span id="more-12674"></span></div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;确定CentOS版本</div>
<div>
	<span style="color:#0000ff;">cat /etc/redhat-release</span></div>
<div>
	&nbsp;</div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;安装EPEL</div>
<div>
	<span style="color:#0000ff;">yum -y install epel-release</span></div>
<div>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a></div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;安装php7的yum源</div>
<div>
	<span style="color:#0000ff;">rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm</span></div>
<div>
	<span style="color:#0000ff;">rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm</span></div>
<div>
	&nbsp;</div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;安装remi的centos7的源</div>
<div>
	<span style="color:#0000ff;">rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm</span></div>
<div>
	&nbsp;</div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;查看已经安装过的PHP包</div>
<div>
	<span style="color:#0000ff;">yum list installed | grep php</span></div>
<div>
	<span style="color:#b22222;">php.x86_64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5.4.16-43.el7_4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @updates</span></div>
<div>
	<span style="color:#b22222;">php-cli.x86_64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5.4.16-43.el7_4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @updates</span></div>
<div>
	<span style="color:#b22222;">php-common.x86_64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.4.16-43.el7_4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @updates</span></div>
<div>
	<span style="color:#b22222;">php-devel.x86_64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5.4.16-43.el7_4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @updates</span></div>
<div>
	<span style="color:#b22222;">php-fpm.x86_64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5.4.16-43.el7_4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @updates</span></div>
<div>
	<span style="color:#b22222;">php-gd.x86_64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5.4.16-43.el7_4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @updates</span></div>
<div>
	<span style="color:#b22222;">php-mysql.x86_64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5.4.16-43.el7_4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @updates</span></div>
<div>
	<span style="color:#b22222;">php-pdo.x86_64&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5.4.16-43.el7_4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @updates</span></div>
<div>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a></div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;安装yum替换插件</div>
<div>
	<span style="color:#0000ff;">yum -y install yum-plugin-replace</span></div>
<div>
	&nbsp;</div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;替换PHP 7的相关模块</div>
<div>
	根据之前用 yum list installed | grep php 命令得到的结果，使用如下命令替换(升级)对应的模块：</div>
<div>
	<span style="color:#0000ff;">yum -y replace php --replace-with=php70w</span></div>
<div>
	<span style="color:#0000ff;">yum -y replace php-cli --replace-with=php70w-cli</span></div>
<div>
	<span style="color:#0000ff;">yum -y replace php-common --replace-with=php70w-common</span></div>
<div>
	<span style="color:#0000ff;">yum -y replace php-devel --replace-with=php70w-devel</span></div>
<div>
	<span style="color:#0000ff;">yum -y replace php-fpm --replace-with=php70w-fpm</span></div>
<div>
	<span style="color:#0000ff;">yum -y replace php-gd --replace-with=php70w-gd</span></div>
<div>
	<span style="color:#0000ff;">yum -y replace php-mysql --replace-with=php70w-mysql</span></div>
<div>
	<span style="color:#0000ff;">yum -y replace php-pdo --replace-with=php70w-pdo</span></div>
<div>
	&nbsp;</div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;移除memcached服务</div>
<div>
<div>
		memcached和PHP7貌似已经不能一起愉快地玩耍了，所以如果原来的PHP 5.4用到了memcached的话，只能从PHP配置文件中把相关的内容注释掉（否则php -v会报错）：</div>
<div>
		<span style="color:#0000ff;">vim /etc/php.ini</span></div>
<div>
		注释掉以下两行：</div>
<div>
		<span style="color:#b22222;">[memcache]</span></div>
<div>
		<span style="color:#b22222;">extension=memcache.so</span></div>
</div>
<div>
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a></div>
<div>
	<span style="color: rgb(0, 0, 255);"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2714.png" alt="✔" class="wp-smiley" style="height: 1em; max-height: 1em;" /></span>&nbsp;重启web服务</div>
<div>
	<span style="color:#0000ff;">systemctl restart nginx</span></div>
<div>
	<span style="color:#0000ff;">systemctl restart php-fpm</span></div>
<div>
	<br />
	<span style="color: rgb(255, 255, 255);">文章来源：</span><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><span style="color: rgb(255, 255, 255);">https://www.codelast.com/</span></a><br />
	<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;版权声明&nbsp;<span style="color: rgb(255, 0, 0);">➤➤</span>&nbsp;<br />
	转载需注明出处：<u><a href="https://www.codelast.com/" rel="noopener noreferrer" target="_blank"><em><span style="color: rgb(0, 0, 255);"><strong style="font-size: 16px;"><span style="font-family: arial, helvetica, sans-serif;">codelast.com</span></strong></span></em></a></u>&nbsp;<br />
	感谢关注我的微信公众号（微信扫一扫）：</p>
<p style="border: 0px; font-size: 13px; margin: 0px 0px 9px; outline: 0px; padding: 0px; color: rgb(77, 77, 77);">
		<img decoding="async" alt="wechat qrcode of codelast" src="https://www.codelast.com/codelast_wechat_qr_code.jpg" style="width: 200px; height: 200px;" /></p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codelast.com/%e5%8e%9f%e5%88%9b-php-5-4-%e5%8d%87%e7%ba%a7%e5%88%b0-7-0/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
