{"id":4325,"date":"2019-10-02T19:53:25","date_gmt":"2019-10-02T16:53:25","guid":{"rendered":"https:\/\/kifarunix.com\/?p=4325"},"modified":"2024-03-12T22:30:06","modified_gmt":"2024-03-12T19:30:06","slug":"install-php-7-4-on-centos-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-php-7-4-on-centos-8\/","title":{"rendered":"Install PHP 7.4 on CentOS 8"},"content":{"rendered":"\n<p>Follow through this guide to install PHP 7.4 on CentOS 8. PHP 7.4 is a minor release of PHP 7 that that comes with a lot of changes meant to boost performance and improve code readability or maintainability. You can check the release <a href=\"https:\/\/www.php.net\/manual\/en\/doc.changelog.php\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"changelog (opens in a new tab)\">changelog<\/a>.<\/p>\n\n\n\n<p>The official release of PHP 7.4 is set to be on November 28, 2019. It is however available for testing purposes and are not suitable for production use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing PHP 7.4 on CentOS 8<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install PHP REMI Repository<\/h3>\n\n\n\n<p>PHP 7.4 is available in\u00a0<strong>remi<\/strong>\u00a0repository. Therefore, install the remi repository to enable you install PHP 7.4.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install https:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm<\/code><\/pre>\n\n\n\n<p>This command will install both REMI and EPEL repositories.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>...\nDependencies resolved.\n=======================================================================================================================================================\n Package                              Arch                           Version                                Repository                            Size\n=======================================================================================================================================================\nInstalling:\n remi-release                         noarch                         8.0-4.el8.remi                         @commandline                          20 k\nInstalling dependencies:\n epel-release                         noarch                         8-5.el8                                extras                                22 k\n\nTransaction Summary\n=======================================================================================================================================================\nInstall  2 Packages\n...<\/code><\/pre>\n\n\n\n<p>Run system update<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf update<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Installing PHP 7.4 on CentOS 8<\/h3>\n\n\n\n<p>Once you have the REMI repos in place, you can verify if they provide PHP 7.4 packages.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf whatprovides php74<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>php74-1.0-1.el8.remi.x86_64 : Package that installs PHP 7.4\nRepo        : remi-safe\nMatched from:\nProvide    : php74 = 1.0-1.el8.remi<\/code><\/pre>\n\n\n\n<p>As you can see from the output above, <code><strong>remi-safe<\/strong><\/code> repository provides php 7.4. If all is good, proceed to install PHP 7.4.<\/p>\n\n\n\n<p>If you want to install the PHP 7.4 and replace the default versions of PHP, simply execute the commands below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf module disable php<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf module install php:remi-7.4<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Verify PHP Versions<\/h3>\n\n\n\n<p>To check the PHP version installed, simply run the command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>php -v<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>PHP 7.4.0RC3 (cli) (built: Oct  1 2019 08:30:29) ( NTS )\nCopyright (c) The PHP Group\nZend Engine v3.4.0-dev, Copyright (c) Zend Technologies<\/code><\/pre>\n\n\n\n<p>You can as well install the SCL version of PHP. The SCL version is recommended for testing purposes since to easily install and use PHP 7.4 parallel installation&nbsp;to other versions of PHP.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php74<\/code><\/pre>\n\n\n\n<p>You can as well verify PHP from Apache web server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/var\/www\/html\/test.php<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n phpinfo();\n?&gt;<\/code><\/pre>\n\n\n\n<p>Save the file and try to access it from browser using the address <strong>http:\/\/server-IP\/test.php<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/10\/php74.png\"><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"608\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/10\/php74.png\" alt=\"Install PHP 7.4 on CentOS 8\" class=\"wp-image-4333\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/10\/php74.png?v=1570035037 940w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/10\/php74-768x497.png?v=1570035037 768w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Installing PHP Extensions<\/h3>\n\n\n\n<p>To install other PHP 7.4 modules, simply run;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php-module_name<\/code><\/pre>\n\n\n\n<p>Where <strong><code>module_name<\/code><\/strong> is the name of the PHP extension. For example, to install MySQL Native Driver module for PHP 7.4;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php-mysqlnd<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>Dependencies resolved.\n=======================================================================================================================================================\n Package                           Arch                         Version                                       Repository                          Size\n=======================================================================================================================================================\nInstalling:\n php-mysqlnd                       x86_64                       7.4.0~RC3-5.el8.remi                          remi-modular                       253 k\nInstalling dependencies:\n php-pdo                           x86_64                       7.4.0~RC3-5.el8.remi                          remi-modular                       139 k\n\nTransaction Summary\n=======================================================================================================================================================\nInstall  2 Packages\n\nTotal download size: 392 k\nInstalled size: 1.3 M\nIs this ok [y\/N]: y<\/code><\/pre>\n\n\n\n<p>You can list compiled PHP modules by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>php -m<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>[PHP Modules]\nbz2\ncalendar\nCore\nctype\ncurl\ndate\ndom\nexif\nfileinfo\n...<\/code><\/pre>\n\n\n\n<p>That is all on installing PHP 7.4 on CentOS 8. You can now run your tests. Enjoy.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Reference<\/h4>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/blog.remirepo.net\/post\/2019\/09\/06\/PHP-on-the-road-to-the-7.4.0-release\" target=\"_blank\">Remi&#8217;s RPM repository &#8211; Blog<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Related Tutorials<\/h4>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-php-7-4-on-debian-10-debian-9\/\">Install PHP 7.4 on Debian 10\/Debian 9<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-phpmyadmin-with-nginx-on-debian-10-buster\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install phpMyAdmin with Nginx on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-php-7-3-4-on-fedora-30\/\" target=\"_blank\">Install PHP 7.3.4 on Fedora 30<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/installing-php-7-3-3-on-centos-7-6\/\" target=\"_blank\">Installing PHP 7.3.3 on CentOS 7.6<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-install-php-7-3-3-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">How to Install PHP 7.3.3 on Ubuntu 18.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Follow through this guide to install PHP 7.4 on CentOS 8. PHP 7.4 is a minor release of PHP 7 that that comes with a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,342],"tags":[1142,203,1132],"class_list":["post-4325","post","type-post","status-publish","format-standard","hentry","category-howtos","category-php","tag-centos-8","tag-php","tag-php-7-4","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4325"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=4325"}],"version-history":[{"count":7,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4325\/revisions"}],"predecessor-version":[{"id":21242,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4325\/revisions\/21242"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=4325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=4325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=4325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}