CentOS7yum安装PHP7.2的操作方法
<p><span><strong>1、如果之前已经安装我们先卸载一下</strong></span></p>
<div class="jb51code">
<div>
<div class="syntaxhighlighterxhtml" id="highlighter_434626">
<div class="toolbar">
<span>?</span>
</div>
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr>
<td class="gutter">
<div class="line number1 index0 alt2">
1</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2">
<code class="xhtml plain">yum -y remove php*</code>
</div>
</div>
</td>
</tr></tbody></table>
</div>
</div>
<div class="codetool" id="codetool">
<div class="code_n">
<textarea></textarea>
</div>
</div>
</div>
<p>
<span><strong>2、由于linux的yum源不存在php7.x,所以我们要更改yum源</strong></span></p>
<div class="jb51code">
<div>
<div class="syntaxhighlighterxhtml" id="highlighter_629154">
<div class="toolbar">
<span>?</span>
</div>
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr>
<td class="gutter">
<div class="line number1 index0 alt2">
1</div>
<div class="line number2 index1 alt1">
2</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2">
<code class="xhtml plain">rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm </code>
</div>
<div class="line number2 index1 alt1">
<code class="xhtml plain">rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm</code>
</div>
</div>
</td>
</tr></tbody></table>
</div>
</div>
<div class="codetool" id="codetool">
<div class="code_n">
<textarea></textarea>
</div>
</div>
</div>
<p>
<span><strong>3、yum 安装php72w和各种拓展,选自己需要的即可</strong></span></p>
<div class="jb51code">
<div>
<div class="syntaxhighlighterxhtml" id="highlighter_538197">
<div class="toolbar">
<span>?</span>
</div>
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr>
<td class="gutter">
<div class="line number1 index0 alt2">
1</div>
</td>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2">
<code class="xhtml plain">yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml</code>
</div>
</div>
</td>
</tr></tbody></table>
</div>
</div>
<div class="codetool" id="codetool">
<div class="code_n">
<textarea></textarea>
</div>
</div>
</div>
<p>
以上这篇CentOS7yum安装PHP7.2的操作方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。</p>
<p>
原文链接:https://blog.csdn.net/hu_zhe_kan/article/details/79368169</p> 感谢分享!正好需要在新服务器上部署PHP7.2,这个教程来得太及时了。
按照你的步骤操作了一下,基本一次性成功。有几个小细节想补充一下:
安装完成后别忘了启动php-fpm服务:
systemctl start php-fpm
systemctl enable php-fpm
另外如果需要安装Redis扩展的话,可以直接用:
yum -y install php72w-redis
还有一点提醒一下,webtatic源现在维护状态不太稳定,如果遇到问题可以试试其他源,比如Remi源:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php72
总体来说步骤很清晰,对新手很友好!支持一下~
原文链接
頁:
[1]