{"id":1096,"date":"2021-08-07T12:19:55","date_gmt":"2021-08-07T04:19:55","guid":{"rendered":"http:\/\/www.dxQerp.com\/?p=1096"},"modified":"2021-09-03T08:10:56","modified_gmt":"2021-09-03T00:10:56","slug":"how-to-install-php-7-4-on-centos-8","status":"publish","type":"post","link":"http:\/\/www.dxQerp.com\/?p=1096","title":{"rendered":"How to Install PHP 7.4 on CentOS 8"},"content":{"rendered":"<h3>\u9996\u5148&nbsp; \u66f4\u65b0&nbsp; \u8edf\u4ef6\u5305<\/h3>\n<!-- \/wp:post-content -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>dnf upgrade<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3>Setup 1 \u2013 \u555f\u7528 PHP \u7a0b\u5f0f\u5eab<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n\n\u7cfb\u7d71\u4e0a\u555f\u7528 EPEL \u548c REMI yum \u5b58\u5132\u5eab\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code {\"className\":\"terminal\"} -->\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<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n\n<strong>\u67e5\u770b \u7cfb\u7d71\u4e0a php \u7684 \u8edf\u4ef6\u5305<\/strong>\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code {\"className\":\"terminal\"} -->\n<pre class=\"wp-block-code terminal\"><code>dnf module list php  <\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n\n<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\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>dnf module reset php\ndnf module enable php:remi-7.4 -y<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:heading {\"level\":3,\"className\":\"heading1\"} -->\n<h3 class=\"heading1\">Step 2 \u2013 \u5b89\u88dd PHP 7.4<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n\n\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\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>dnf install php php-cli php-common<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n\n\u5b89\u88dd\u6210\u529f\u5f8c\uff0c\u57f7\u884c\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u7cfb\u7d71\u4e0a\u5df2\u5b89\u88dd\u7684 PHP \u7248\u672c..\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>php -v<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3>Step 3 \u2013 Apache \u9023\u7d50 PHP 7.4<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n\n\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\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n\n\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\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n\n\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\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\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:\/\/192.168.17.9\/info.php<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3>Step 4 \u2013 \u5b89\u88dd PHP \u64f4\u5c55\u3002<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n\n\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\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>dnf search php-*<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n\n\u73fe\u5728\uff0c\u70ba\u60a8\u7684\u61c9\u7528\u7a0b\u5e8f\u5b89\u88dd\u6240\u6709\u5fc5\u9700\u7684 PHP \u64f4\u5c55\u3002.\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>dnf install php-gd php-mbstring php-mysqlnd<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n\n\u4f7f\u7528 -m \u9078\u9805\u67e5\u770b\u7576\u524d\u555f\u7528\u7684 php \u64f4\u5c55\u3002\n\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>php -m\nphp -m | grep extension-name<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3>THE END<\/h3>\n<strong>\u53c3\u8003<\/strong>\n\n<a href=\"https:\/\/www.myfreax.com\/how-to-install-php-on-centos-8\/\">https:\/\/www.myfreax.com\/how-to-install-php-on-centos-8\/<\/a>","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148&nbsp; \u66f4\u65b0&nbsp; \u8edf\u4ef6\u5305 dnf upgrade Setup 1 \u2013 \u555f\u7528 PHP \u7a0b\u5f0f\u5eab  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1148,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[13],"tags":[],"class_list":["post-1096","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-problems"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.dxQerp.com\/wp-content\/uploads\/2021\/08\/php7.4.png?fit=290%2C244","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1096"}],"version-history":[{"count":3,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1096\/revisions"}],"predecessor-version":[{"id":1149,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1096\/revisions\/1149"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/media\/1148"}],"wp:attachment":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1096"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}