{"id":1207,"date":"2021-08-06T09:19:19","date_gmt":"2021-08-06T01:19:19","guid":{"rendered":"https:\/\/www.dxQerp.cn\/?p=1207"},"modified":"2021-09-06T06:59:31","modified_gmt":"2021-09-05T22:59:31","slug":"how-to-install-php-8-on-centos-8","status":"publish","type":"post","link":"http:\/\/www.dxQerp.cn\/?p=1207","title":{"rendered":"PHP 7.4 \u5b89\u88dd \u5728 CentOS 8"},"content":{"rendered":"\n<h3>\u9996\u5148&nbsp; \u66f4\u65b0&nbsp; \u8edf\u4ef6\u5305<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf upgrade<\/code><\/pre>\n\n\n\n<h3>Setup 1 \u2013 \u555f\u7528 PHP \u7a0b\u5f0f\u5eab<\/h3>\n\n\n\n<p>\u7cfb\u7d71\u4e0a\u555f\u7528 EPEL \u548c REMI yum \u5b58\u5132\u5eab<\/p>\n\n\n\n<pre class=\"wp-block-code terminal\"><code>dnf install -y https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-8.noarch.rpm  \ndnf install -y https:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm <\/code><\/pre>\n\n\n\n<p><strong>\u67e5\u770b \u7cfb\u7d71\u4e0a php \u7684 \u8edf\u4ef6\u5305<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code terminal\"><code>dnf module list php  <\/code><\/pre>\n\n\n\n<p><strong>\u4f7f\u7528 dnf \u547d\u4ee4\u884c\u5de5\u5177\u6fc0\u6d3b\u5305\u542b PHP&nbsp; \u8edf\u4ef6\u5305\u7684 php:remi-7.4 \u5b58\u5132\u5eab<\/strong>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf module reset php\ndnf module enable php:remi-7.4 -y<\/code><\/pre>\n\n\n\n<h3 class=\"heading1\">Step 2 \u2013 \u5b89\u88dd PHP 7.4<\/h3>\n\n\n\n<p>\u60a8\u7684\u7cfb\u7d71\u5df2\u6e96\u5099\u597d\u5b89\u88dd PHP 7.4\u3002 \u5f9e <strong>\u7d42\u7aef\u6a5f<\/strong> \u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf install php php-cli php-common<\/code><\/pre>\n\n\n\n<p>\u5b89\u88dd\u6210\u529f\u5f8c\uff0c\u57f7\u884c\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u7cfb\u7d71\u4e0a\u5df2\u5b89\u88dd\u7684 PHP \u7248\u672c..<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v<\/code><\/pre>\n\n\n\n<h3>Step 3 \u2013 Apache \u9023\u7d50 PHP 7.4<\/h3>\n\n\n\n<p>\u4f46\u5728\u5927\u591a\u6578\u60c5\u6cc1\u4e0b\uff0c\u6211\u5011\u4f7f\u7528 Apache \u4f86\u90e8\u7f72\u57fa\u65bc PHP \u7684 Web \u61c9\u7528\u7a0b\u5e8f\u3002 \u53ea\u9700\u5c0d\u7cfb\u7d71\u4e0a\u7684 Apache Web \u670d\u52d9\u5668\u57f7\u884c\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u73fe\u5728\uff0c\u78ba\u5be6\u53ef\u4ee5\u8b80\u53d6 Apache \u4ee5\u901a\u904e Web \u63d0\u4f9b php \u6587\u4ef6\u3002 \u8b93\u6211\u5011\u5728 CentOS \u670d\u52d9\u5668\u4e0a\u5275\u5efa php \u4fe1\u606f\u6587\u4ef6\u3002<\/p>\n\n\n\n<p>\u9ed8\u8a8d\u7684 <strong>virtulhost<\/strong> \u4f7f\u7528 \/var\/www\/html \u4f5c\u70ba\u6587\u6a94\u6839\u76ee\u9304\u3002 \u6240\u4ee5\u5728\u9019\u500b\u76ee\u9304\u4e0b\u5275\u5efa\u4e00\u500b\u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"&lt;?php phpinfo(); ?&gt;\" &gt; \/var\/www\/html\/info.php\n\nsystemctl enable --now php-fpm   # \u555f\u52d5 php\nsystemctl restart httpd          # \u91cd\u555f httpd\nhttp:&#47;&#47;192.168.17.9\/info.php<\/code><\/pre>\n\n\n\n<h3>Step 4 \u2013 \u5b89\u88dd PHP \u64f4\u5c55\u3002<\/h3>\n\n\n\n<p>\u901a\u5e38\uff0cWeb \u61c9\u7528\u7a0b\u5e8f\u4f9d\u8cf4\u65bc\u591a\u500b <strong>PHP \u64f4\u5c55<\/strong>\u3002 <strong>PHP \u64f4\u5c55<\/strong>\u662f\u70ba\u7279\u5b9a\u4efb\u52d9\u5c08\u9580\u69cb\u5efa\u7684\u7a0b\u5f0f\u5eab\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf search php-*<\/code><\/pre>\n\n\n\n<p>\u73fe\u5728\uff0c\u70ba\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\u5b89\u88dd\u6240\u6709\u5fc5\u9700\u7684 PHP \u64f4\u5c55\u3002.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf install php-gd php-mbstring php-mysqlnd<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528 -m \u9078\u9805\u67e5\u770b\u7576\u524d\u555f\u7528\u7684 php \u64f4\u5c55\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -m<br>php -m | grep extension-name<\/code><\/pre>\n\n\n\n<h3>THE END<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148&nbsp; \u66f4\u65b0&nbsp; \u8edf\u4ef6\u5305 Setup 1 \u2013 \u555f\u7528 PHP \u7a0b\u5f0f\u5eab \u7cfb\u7d71\u4e0a\u555f\u7528 EPEL \u548c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1494,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[],"jetpack_featured_media_url":"http:\/\/www.dxQerp.cn\/wp-content\/uploads\/2021\/08\/php7.4.png","_links":{"self":[{"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/posts\/1207"}],"collection":[{"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1207"}],"version-history":[{"count":19,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/posts\/1207\/revisions"}],"predecessor-version":[{"id":1502,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/posts\/1207\/revisions\/1502"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/media\/1494"}],"wp:attachment":[{"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1207"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}