Here is a quick howto upgrade default PHP version provided on Fedora, RHEL or CentOS with latest version 7.4. Show
Repositories configuration:On Fedora, standards repositories are enough, on Enterprise Linux (RHEL, CentOS) the Extra Packages for Enterprise Linux (EPEL) repository must be configured, and on RHEL the optional channel must be enabled. Fedora 31dnf install https://rpms.remirepo.net/fedora/remi-release-31.rpm Fedora 30dnf install https://rpms.remirepo.net/fedora/remi-release-30.rpm RHEL version 8.1dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm RHEL version 7.7wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm subscription-manager repos --enable=rhel-7-server-optional-rpms CentOS version 8.0dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm CentOS version 7.7wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm php module usageWith Fedora modular and RHEL / CentOS 8, you can simply use the remi-7.4 stream of the php module dnf module reset php dnf module install php:remi-7.4 remi-php74 repository activationNeeded packages are in the remi-safe (enabled by default) and remi-php74 repositories, the latest is not enabled by default (administrator choice according to the desired PHP version). RHEL or CentOS 7yum install yum-utils yum-config-manager --enable remi-php74 Fedoradnf config-manager --set-enabled remi-php74 PHP upgradeBy choice, the packages have the same name than in the distribution, so a simple update is enough: yum update That's all :) $ php -v PHP 7.4.0 (cli) (built: Nov 26 2019 20:13:36) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies Known issuesThe upgrade can fail (by design) when some installed extensions are not yet compatible with PHP 7.4. See the compatibility tracking list: PECL extensions RPM status If these extensions are not mandatory, you can remove them before the upgrade, else, you will have to be patient. Warning: some extensions are still under development, but it seems useful to provide them to allow upgrade to more people, and to allow user to give feedback to the authors. More d'informationIf you prefer to install PHP 7.4 beside default PHP version, this can be achieved using the php74 prefixed packages, see the PHP 7.4 as Software Collection post. You can also try the configuration wizard. The packages available in the repository was used as source for Fedora 32 (self contained change proposal, is already accepted and testable). By providing a full feature PHP stack, with about 130 available extensions, 6 PHP versions, as base and SCL packages, for Fedora and Enterprise Linux, and with 200 000 download per day, remi repository became in the last 14 years a reference for PHP users on RPM based distributions, maintained by an active contributor to the projects (Fedora, PHP, PECL...). See also:
PHP is a widely-used open-source programming language for web development created by Rasmus Lerdorf. It is an HTML-embedded scripting language for creating dynamic web sites. CentOS 7/6 comes with PHP 5.x by default which is already the end of life. In this post, we will see how to install PHP 7.4 / 7.3 / 7.2 on CentOS 7 / RHEL 7 & CentOS 6 / RHEL 6. Add PHP 7.x RepositoryRemi, a third-party repository which offers the latest version of PHP (7.4 / 7.3 / 7.2 / 7.1) for CentOS. To enable the Remi repository, install the Remi repository auto-configuration package. ### CentOS 7 / RHEL 7 ### yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm ### CentOS 6 / RHEL 6 ### yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm yum install -y https://rpms.remirepo.net/enterprise/remi-release-6.rpm Install PHP 7.4 on CentOS 7Use the below command to install PHP 7.4 package by temporarily enabling Remi PHP 7.4 repository. Remi doesn’t provide PHP 7.4 packages for CentOS 6 yum install -y --enablerepo=remi-php74 php php-cli Install PHP 7.3 on CentOS 7 & CentOS 6Use the below command to install PHP 7.3 package by temporarily enabling Remi PHP 7.3 repository. yum install -y --enablerepo=remi-php73 php php-cli Install PHP 7.2 on CentOS 7 & CentOS 6Use the below command to install PHP 7.2 package by temporarily enabling Remi PHP 7.2 repository. yum install -y --enablerepo=remi-php72 php php-cli Install PHP 7.1 on CentOS 7 & CentOS 6Use the below command to install PHP 7.1 package by temporarily enabling Remi PHP 7.1 repository. yum install -y --enablerepo=remi-php71 php php-cli Check PHP VersionOnce you have installed the required PHP version, check the PHP version with the following command. php -v Output: PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies Install PHP ExtensionsPHP extensions are compiled libraries which enables specific functions/support for your code. For example, installing PHP MySQL extension will enable your PHP code to connect with the MySQL database. PHP extensions package is normally named like php-<extn_name>. To install MySQL support, you can install php-mysqlnd package. yum install -y --enablerepo=remi-php74 php-mysqlnd Once you have installed a particular extension, you can use the below command to verify it. php -m | grep -i mysql Output: mysqli
mysqlnd
pdo_mysql PHP Extensions for WordPressThe following extensions are good enough to install and run WordPress on your CentOS system. WordPress recommends having PHP v7.3 for the installation. yum install -y --enablerepo=remi-php73 php-dom php-simplexml php-ssh2 php-xml php-xmlreader php-curl php-date php-exif php-filter php-ftp php-gd php-hash php-iconv php-imagick php-json php-libxml php-mbstring php-mysqlnd php-openssl php-pcre php-posix php-sockets php-spl php-tokenizer php-zlib PHP Extensions for JoomlaThe following extensions are good enough to install and run Joomla on your CentOS system. Joomla requires PHP v7.1 and above. yum install -y --enablerepo=remi-php73 php-mysqlnd php-zlib php-xml php-pear php-json php-mcrypt PHP Extensions for DrupalThe following extensions are good enough to install and run Joomla on your CentOS system. Drupal requires PHP v7.1 and above. yum install -y --enablerepo=remi-php73 php-mysqlnd php-date php-dom php-filter php-gd php-hash php-json php-pcre php-pdo php-session php-simplexml php-spl php-tokenizer php-xml ConclusionThat’s All. Please share your feedback in the comments section. How do I install or upgrade to PHP 7 on CentOS 7 Linux?Upgrade to PHP 7. sudo yum install https://centos7.iuscommunity.org/ius-release.rpm. ... . sudo yum remove php-common mod_php php-cli. ... . sudo yum update. ... . sudo yum install php70u php70u-pdo php70u-mysqlnd php70u-opcache php70u-xml php70u-gd php70u-devel php70u-mysql. ... . sudo systemctl restart httpd.. How do I download and install PHP on Linux?Follow the below steps to install PHP on Linux:. Step 1: Open your terminal in Linux. On your Linux computer open the terminal. ... . Step 2: Update your packages. On your terminal update your packages using the following command. ... . Step 3: Upgrade your packages. ... . Step 4: Install PHP.. What is the latest version of PHP 7?PHP 7.4, the final release in the PHP 7.
How do I install a new version of PHP?Follow the below steps to install PHP on Windows: Step 1: Visit https://www.php.net/ website using any web browser and click on Downloads. Step 2: Click on the Windows “Downloads” button. Step 3: The new webpage has different options, choose the Thread safe version, and click on the zip button and Download it.
|