{"id":6090,"date":"2021-02-05T16:13:28","date_gmt":"2021-02-05T10:43:28","guid":{"rendered":"https:\/\/www.skynats.com\/?p=6090"},"modified":"2025-10-28T12:05:27","modified_gmt":"2025-10-28T06:35:27","slug":"php-8-on-centos-rhel-8-7-installation","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/php-8-on-centos-rhel-8-7-installation\/","title":{"rendered":"How to install PHP 8 on CentOS\/RHEL 8\/7"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The PHP is an open-source server-side scripting language that suits to web development. The PHP finally released on November 26th, 2020 with lots of improvement and optimization. This blog helps you to install PHP 8 on CentOS\/RHEL 8\/7. If you are looking for PHP installation and server management, please contact our expert team to get it done on behalf of you. you can also refer<a href=\"https:\/\/www.skynats.com\/linux-server-management\/\"> our server management plan<\/a>&nbsp;for further assistance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-step-1-enable-epel-repository-on-centos\"><strong>Step 1: Enable EPEL repository on CentOS<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Enable the EPEL repository into your system. The EPEL provides the extra packages for enterprise Linux that are not available by default on <a href=\"https:\/\/www.centos.org\/\" target=\"_blank\" rel=\"noopener\">CentOS<\/a>\/RHEL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dnf install -y https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-8.noarch.rpm  &#91;On CentOS\/RHEL 8]\n$ sudo dnf install -y https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-7.noarch.rpm  &#91;On CentOS\/RHEL 7]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The Remi repository which is a third-party repository that provides wide ranges of PHP version.<br>Run the following commands to install the Remi repository.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dnf install -y https:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm  &#91;On CentOS\/RHEL 8]\n$ sudo dnf install -y https:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm  &#91;On CentOS\/RHEL 7]\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-step-2-install-php-8-on-centos-rhel-8-7\"><strong>Step 2: Install PHP 8 on CentOS\/RHEL 8\/7<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once the installation is done, proceed and list the available PHP module streams.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dnf module list PHP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Right side at the bottom, ensure to note the Remi-8.0 PHP module.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"895\" height=\"321\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW.png\" alt=\"Install PHP 8 on CentOS\/RHEL 8\/7\" class=\"wp-image-6091\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW.png 895w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW-300x108.png 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW-768x275.png 768w\" sizes=\"(max-width: 895px) 100vw, 895px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Enable the module before installing the PHP 8.0. To enable the PHP: Remi-8.0 execute the following command.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"903\" height=\"233\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW-2.png\" alt=\"Enable the PHP: Remi-8.0 \" class=\"wp-image-6092\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW-2.png 903w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW-2-300x77.png 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW-2-768x198.png 768w\" sizes=\"(max-width: 903px) 100vw, 903px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading has-normal-font-size\" id=\"h-install-php-8-0-for-apache\"><strong>Install PHP 8.0 for Apache.<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command to executive the 8.0 for Apache.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dnf install php php-cli php-common<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"905\" height=\"291\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW3.png\" alt=\"PHP 8.0 for Apache.\" class=\"wp-image-6093\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW3.png 905w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW3-300x96.png 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/NOW3-768x247.png 768w\" sizes=\"(max-width: 905px) 100vw, 905px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading has-normal-font-size\" id=\"h-installing-php-8-0-for-nginx\"><strong>Installing PHP 8.0 for Nginx<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dnf install php php-cli php-common php-fpm<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-step-3-verify-php-8-0-on-centos-rhel\"><strong>Step 3: Verify php 8.0 on centOS\/RHEL<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>$ php -v<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"601\" height=\"124\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now4.png\" alt=\"Verifying php 8.0 \" class=\"wp-image-6094\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now4.png 601w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now4-300x62.png 300w\" sizes=\"(max-width: 601px) 100vw, 601px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following PHP code to populate the version of PHP.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\nphpinfo();\n\n?&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add and exit and ensure to restart the Apache or Nginx web server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo systemctl restart httpd\n$ sudo systemctl restart nginx\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Paste the URL on the browser and go to the address shown.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;server-ip\/info.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It displays a website that consists of information regarding the PHP that has been installed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"401\" sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now5-1024x401.png\" alt=\"PHP VERSION 8.0.0\" class=\"wp-image-6095\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now5-1024x401.png 1024w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now5-300x118.png 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now5-768x301.png 768w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now5.png 1107w\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-step-4-install-php-8-0-extentions-in-centos-rhel\"><strong>Step 4: Install PHP 8.0 extentions in centOS\/RHEL<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following commands to verify the installed PHP extensions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dnf install php-{extension-name}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, you can verify the installed extensions by following the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ php -m<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Execute, to verify specific extensions are installed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ php -m | grep extension-name<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ php -m | grep mysqlnd<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"82\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now6.png\" alt=\"CentOS\" class=\"wp-image-6096\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now6.png 438w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/02\/now6-300x56.png 300w\" sizes=\"(max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading has-normal-font-size\" id=\"h-conclusion-nbsp\"><strong>Conclusion:&nbsp;<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This blog will help you to Install PHP 8 on CentOS\/RHEL 8\/7. Follow the step if any error occurs you can contact our technical team support available 24\/7 for any assistance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The PHP is an open-source server-side scripting language that suits to web development. The PHP finally released on November 26th, 2020 with lots of improvement and optimization. This blog helps you to install PHP 8 on CentOS\/RHEL 8\/7. If you are looking for PHP installation and server management, please contact our expert team to get [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[232,102,25,231,233,72],"class_list":["post-6090","post","type-post","status-publish","format-standard","hentry","category-blog","tag-centos-8","tag-centos7","tag-cloud-management","tag-install-php-8","tag-rhel-8-7","tag-server-management"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/6090","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=6090"}],"version-history":[{"count":1,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/6090\/revisions"}],"predecessor-version":[{"id":16409,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/6090\/revisions\/16409"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=6090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=6090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=6090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}