{"id":1777,"date":"2020-07-11T18:26:08","date_gmt":"2020-07-12T01:26:08","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=1777"},"modified":"2020-07-11T18:26:10","modified_gmt":"2020-07-12T01:26:10","slug":"how-to-install-php-7-4-on-centos-8-rhel-8","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=1777","title":{"rendered":"How to Install PHP 7.4 on CentOS 8 \/ RHEL 8"},"content":{"rendered":"\n<p>by\u00a0Pradeep Kumar\u00a0<\/p>\n\n\n\n<p>PHP (Hypertext Preprocessor) is the most popular server-side scripting language and used in developing static and dynamic web sites. In this article, we will demonstrate how to install the latest version of PHP 7.4 on CentOS 8 and RHEL 8.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Minimum System Requirements for PHP 7.4<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>Minimal CentOS 8 \/ RHEL 8 OS<\/li><li>Sudo or Root Privileges<\/li><li>Basic Package Repositories<\/li><li>Internet Connection<\/li><\/ul>\n\n\n\n<p>Let\u2019s jump into installation steps,<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step:1) Enable EPEL and Remi Repository<\/h4>\n\n\n\n<p>In the default CentOS 8 and RHEL 8 package repositories,\u00a0<strong>PHP 7.2 \/ 7.3<\/strong>\u00a0is available and to install the latest version of PHP 7.4, we must configure EPEL and REMI repositories, so to enable the repositories, run the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[pkumar@linuxtechi ~]$ sudo dnf install epel-release -y\n[pkumar@linuxtechi ~]$ sudo dnf install https:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm -y<\/pre>\n\n\n\n<p>Once the repositories are configured and enabled, run the following dnf command to view available PHP versions,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[pkumar@linuxtechi ~]$ dnf module list php<\/pre>\n\n\n\n<p>As we can see in above output, PHP 7.2 is the default package from CentOS-8 AppStream repository, so in the next step, we will enable latest PHP module stream (redmi-7.4) so that when we install install PHP using dnf then it will automatically pick packages from remi-7.4 module<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Step:2) Enable latest PHP Module Stream (remi-7.4)<\/h4>\n\n\n\n<p>Execute the following dnf command to enable remi-7.4 PHP module,<\/p>\n\n\n\n<figure><iframe width=\"580\" height=\"400\"><\/iframe><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\">[pkumar@linuxtechi ~]$ sudo dnf module enable php:remi-7.4<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Step:3) Install and Verify PHP<\/h4>\n\n\n\n<p>Now run the following dnf command to install PHP 7.4,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[pkumar@linuxtechi ~]$ sudo dnf install php php-cli php-common<\/pre>\n\n\n\n<p>As we can see that it is installing its dependencies like httpd and nginx, So once above packages are installed successfully, run below \u201c<strong>php -v<\/strong>\u201d command to verify installed php version,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[pkumar@linuxtechi ~]$ php -v<\/pre>\n\n\n\n<figure><iframe width=\"970\" height=\"250\"><\/iframe><\/figure>\n\n\n\n<p>While installing PHP, php-fpm is also installed as its dependency, it will be treated as FastCGI Server, so use below command to start and enable FPM service,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[pkumar@linuxtechi ~]$ sudo systemctl start php-fpm\n[pkumar@linuxtechi ~]$ sudo systemctl enable php-fpm<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Step:4) Updating PHP Parameters<\/h4>\n\n\n\n<p>While using the php in different&nbsp;<strong>CMS<\/strong>&nbsp;(Content Management System) like&nbsp;<strong>WordPress<\/strong>,&nbsp;<strong>Drupal<\/strong>,&nbsp;<strong>Joomla<\/strong>&nbsp;and MediaWiki etc we might have to update default PHP parameters to improve the performance. These parameters can be alerted from its configuration file \u201c<strong>\/etc\/php.ini<\/strong>\u201d,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[pkumar@linuxtechi ~]$ sudo vi \/etc\/php.ini\n\u2026\u2026\u2026\u2026\nupload_max_filesize = 32M \npost_max_size = 48M \nmemory_limit = 256M \nmax_execution_time = 600 \nmax_input_vars = 3000 \nmax_input_time = 1000\n\u2026\u2026\u2026<\/pre>\n\n\n\n<p>Save and exit the file, To make the above changes into the effect restart your web server service (httpd or nginx )<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[pkumar@linuxtechi ~]$ sudo systemctl restart httpd<\/pre>\n\n\n\n<p>That\u2019s all from this article, I hope these steps help you install and configure PHP 7.4 on your CentOS 8 and RHEL 8 System. Your feedback and comments are most welcome.<\/p>\n\n\n\n<p>Reference: <a href=\"https:\/\/www.linuxtechi.com\/install-php-on-centos-8-rhel-8\/\">https:\/\/www.linuxtechi.com\/install-php-on-centos-8-rhel-8\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>by\u00a0Pradeep Kumar\u00a0 PHP (Hypertext Preprocessor) is the most popular server-side scripting language and used in developing static and dynamic web sites. In this article, we will demonstrate how to install the latest version of PHP 7.4 on CentOS 8 and RHEL 8. Minimum System Requirements for PHP 7.4 Minimal CentOS 8 \/ RHEL 8 OS <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=1777\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5,263],"tags":[184,264],"class_list":["post-1777","post","type-post","status-publish","format-standard","hentry","category-linux","category-php","tag-centos-8","tag-php-7-4"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/1777","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1777"}],"version-history":[{"count":0,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/1777\/revisions"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}