{"id":11171,"date":"2021-10-15T11:30:00","date_gmt":"2021-10-15T11:30:00","guid":{"rendered":"https:\/\/linuxways.net\/?p=11171"},"modified":"2021-10-15T11:30:00","modified_gmt":"2021-10-15T11:30:00","slug":"how-to-install-php-7-4-on-centos-8","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-install-php-7-4-on-centos-8\/","title":{"rendered":"How to Install PHP 7.4 on CentOS 8"},"content":{"rendered":"<p>PHP (Hypertext Preprocessor) is the most commonly used server-side scripting language that is used to create dynamic websites. All most popular CMS (Content Management Systems) and frameworks such as WordPress, Laravel, and Magento are built in PHP programming.\u00a0 You will explore in this guide how you can install PHP 7.4 version on CentOS 8 system. Different PHP versions are available for installation on CentOS 8. Before choosing a PHP version for installation from all of them, make sure this version must meet the application requirements.<\/p>\n<h2><strong>Installation of PHP on CentOS 8<\/strong><\/h2>\n<p>To install the PHP on CentOS 8 system, you require performing the following steps:<\/p>\n<h3><strong>Step 1: Enable Remi repository<\/strong><\/h3>\n<p>In CentOS 8, the PHP 7.2 version is used as the default version that supports most of the modern web applications. However, based on your application support, you can install the latest available PHP version on your system using the <a href=\"https:\/\/rpms.remirepo.net\/\">Remi repository<\/a>. So, if you need to install PHP 7.3 or 7.4 then, by executing the following command enable the Remi repository:<\/p>\n<pre>$ sudo yum install yum-utils http:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1205\" height=\"764\" class=\"wp-image-11172\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-300.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-300.png 1205w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-300-300x190.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-300-1024x649.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-300-768x487.png 768w\" sizes=\"auto, (max-width: 1205px) 100vw, 1205px\" \/><\/p>\n<p>After running the above command, the EPEL repository will also be enabled on your system.<\/p>\n<p>Once the repository is Remi repository is enabled on your system, list the available PHP version by executing the below-mentioned command:<\/p>\n<pre>$ sudo dnf module list php<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"484\" class=\"wp-image-11173\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-301.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-301.png 1200w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-301-300x121.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-301-1024x413.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-301-768x310.png 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<h3><strong>Step 2: Enable PHP module<\/strong><\/h3>\n<p>As we discussed earlier, the PHP module is default set to PHP 7.2. If you want to install the latest PHP release then, enable the appropriate version on your CentOS 8 system.<\/p>\n<p>To enable the PHP 7.3, you can use the below-mentioned commands:<\/p>\n<pre>$ sudo dnf module reset php<\/pre>\n<pre>$ sudo dnf module enable php:remi-7.3<\/pre>\n<p>For example, we want to install the latest PHP 7.4 release on CentOS 8 system. In this case, by running the following command, you can enable it on your system:<\/p>\n<pre>$ sudo dnf module reset php<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"385\" class=\"wp-image-11174\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-302.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-302.png 1200w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-302-300x96.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-302-1024x329.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-302-768x246.png 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<pre>$ sudo dnf module enable php:remi-7.4<\/pre>\n<p>Now, the PHP 7.4 module is enabled on your system as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1193\" height=\"409\" class=\"wp-image-11175\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-303.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-303.png 1193w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-303-300x103.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-303-1024x351.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-303-768x263.png 768w\" sizes=\"auto, (max-width: 1193px) 100vw, 1193px\" \/><\/p>\n<h3><strong>Step 3: Installing PHP on CentOS 8<\/strong><\/h3>\n<p>It\u2019s time to start the installation of PHP and common PHP 7.4 module as follows:<\/p>\n<pre>$ sudo yum install php-fpm php-common php-cli<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1197\" height=\"756\" class=\"wp-image-11176\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-304.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-304.png 1197w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-304-300x189.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-304-1024x647.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-304-768x485.png 768w\" sizes=\"auto, (max-width: 1197px) 100vw, 1197px\" \/><\/p>\n<p>The above command will not install apache dependencies. During installing the above modules, the FPM will be installed as a dependency. This will be used as a FastCGI server. Now, enable and start the FPM service by running the following command:<\/p>\n<pre>$ sudo systemctl enable \u2013now php-fpm<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1196\" height=\"114\" class=\"wp-image-11177\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-305.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-305.png 1196w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-305-300x29.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-305-1024x98.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-305-768x73.png 768w\" sizes=\"auto, (max-width: 1196px) 100vw, 1196px\" \/><\/p>\n<pre>$ sudo systemctl start php-fpm.service<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1195\" height=\"626\" class=\"wp-image-11178\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-306.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-306.png 1195w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-306-300x157.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-306-1024x536.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-306-768x402.png 768w\" sizes=\"auto, (max-width: 1195px) 100vw, 1195px\" \/><\/p>\n<p>Now, check the installed Php version by using the following command:<\/p>\n<pre>$ php --version<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1197\" height=\"168\" class=\"wp-image-11179\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-307.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-307.png 1197w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-307-300x42.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-307-1024x144.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-307-768x108.png 768w\" sizes=\"auto, (max-width: 1197px) 100vw, 1197px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>We have installed PHP on CentOS 8 in this article. Moreover, we explored how to change the default PHP version to the latest available version. After installing the PHP on your system, you can configure it with an Apache webserver or Nginx. Thanks!<\/p>","protected":false},"excerpt":{"rendered":"<p>PHP (Hypertext Preprocessor) is the most commonly used server-side scripting language that is used to create dynamic websites. All most popular CMS (Content Management Systems) and frameworks such&hellip;<\/p>","protected":false},"author":1,"featured_media":11222,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[93,70],"class_list":["post-11171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos-8","tag-php"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=11171"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11171\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/11222"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=11171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=11171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=11171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}