{"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

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 changelog<\/a>.<\/p>\n\n\n\n

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

Installing PHP 7.4 on CentOS 8<\/h2>\n\n\n\n

Install PHP REMI Repository<\/h3>\n\n\n\n

PHP 7.4 is available in\u00a0remi<\/strong>\u00a0repository. Therefore, install the remi repository to enable you install PHP 7.4.<\/p>\n\n\n\n

dnf install https:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm<\/code><\/pre>\n\n\n\n

This command will install both REMI and EPEL repositories.<\/p>\n\n\n\n

...\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

Run system update<\/p>\n\n\n\n

dnf update<\/code><\/pre>\n\n\n\n

Installing PHP 7.4 on CentOS 8<\/h3>\n\n\n\n

Once you have the REMI repos in place, you can verify if they provide PHP 7.4 packages.<\/p>\n\n\n\n

dnf whatprovides php74<\/code><\/pre>\n\n\n\n
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

As you can see from the output above, remi-safe<\/strong><\/code> repository provides php 7.4. If all is good, proceed to install PHP 7.4.<\/p>\n\n\n\n

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

dnf module disable php<\/code><\/pre>\n\n\n\n
dnf module install php:remi-7.4<\/code><\/pre>\n\n\n\n

Verify PHP Versions<\/h3>\n\n\n\n

To check the PHP version installed, simply run the command;<\/p>\n\n\n\n

php -v<\/code><\/pre>\n\n\n\n
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

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 to other versions of PHP.<\/p>\n\n\n\n

dnf install php74<\/code><\/pre>\n\n\n\n

You can as well verify PHP from Apache web server.<\/p>\n\n\n\n

vim \/var\/www\/html\/test.php<\/code><\/pre>\n\n\n\n
<?php\n phpinfo();\n?><\/code><\/pre>\n\n\n\n

Save the file and try to access it from browser using the address http:\/\/server-IP\/test.php<\/strong>.<\/p>\n\n\n\n

\"Install<\/a><\/figure>\n\n\n\n

Installing PHP Extensions<\/h3>\n\n\n\n

To install other PHP 7.4 modules, simply run;<\/p>\n\n\n\n

dnf install php-module_name<\/code><\/pre>\n\n\n\n

Where 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

dnf install php-mysqlnd<\/code><\/pre>\n\n\n\n
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

You can list compiled PHP modules by running the command below;<\/p>\n\n\n\n

php -m<\/code><\/pre>\n\n\n\n
[PHP Modules]\nbz2\ncalendar\nCore\nctype\ncurl\ndate\ndom\nexif\nfileinfo\n...<\/code><\/pre>\n\n\n\n

That is all on installing PHP 7.4 on CentOS 8. You can now run your tests. Enjoy.<\/p>\n\n\n\n

Reference<\/h4>\n\n\n\n

Remi’s RPM repository – Blog<\/a><\/p>\n\n\n\n

Related Tutorials<\/h4>\n\n\n\n

Install PHP 7.4 on Debian 10\/Debian 9<\/a><\/p>\n\n\n\n

Install phpMyAdmin with Nginx on Debian 10 Buster<\/a><\/p>\n\n\n\n

Install PHP 7.3.4 on Fedora 30<\/a><\/p>\n\n\n\n

Installing PHP 7.3.3 on CentOS 7.6<\/a><\/p>\n\n\n\n

How to Install PHP 7.3.3 on Ubuntu 18.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

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}]}}