tl;dr: Skip down to How To Run 2 Versions Of PHP
How To Run 2 Versions Of PHP On The Same CentOS Server
Part of our moving to a mobile-oriented eCommerce platform and away from our former desktop orientation involved us upgrading from Drupal 6 to Drupal 7.That, and the forces of time, technology and fashion! All of the technologies involved in our Drupal 6 eCommerce website were reaching (or had reached) their End Of Life (EOL) date. This meant that our business was relying on technologies that were no longer supported by their respective communities.
So, after resisting the inexorable forces of time for as long as possible, we recognized that the market had truly moved on and the inevitable had arrived.
It was time to upgrade. What a drag. I say this because we had 10 years of accumulated operating information on our "obsolete" Drupal 6 eCommerce website that we and our customers relied on constantly, and were loathe to abandon.
In terms of our Drupal 7 migration; while we had managed to help our customers keep their login username and email information, we had to force our customers to re-initialize their passwords because there is no way to migrate user passwords from Drupal 6 (MD5) to Drupal 7 (SHA512).
The last challenge for us in terms of moving customers from Drupal 6 to Drpual 7 was to somehow figure out a way to move customer order history from Drupal 6 to Drupal 7. This was being complicated by the fact that we had completely re-built our Drupal 7 eCommerce website from scratch, leaving the product (pid) values different between the two website databases, and the structure of the databases had changed between Drupal 6 (which used Ubercart 2) and Drupal 7 (which uses Ubercart 3). While the Drupal 6 database schema and the Drupal 7 database schema had not changed much, Ubercart database schema had, and that's where order data was being kept.
With the imminent retirement of our old server, and the migration of order history information getting complicate, it became critical to figure out a way to be able to run parallel versions of our website (old & new) on a single server, because the old server hosting the old website was being decommissioned.
Here's a quick analysis of our situation. The ideal solution seemed to be to figure out a way to be able to run both websites on the same server for a little while, so as to enable customer order history lookup...but with only the OLD website available to the Administrator!
...at least, until we figure out a way to migrate the customer order history across from Drupal 6 to Drupal 7 and then maybe we just turn the old website off - or keep it around just for its historical lookup potential.
Unfortunately, simply migrating the Drupal 6 database and website code over to the new server didn't work, because PHP has changed over time.
OLD:
- CentOS release 6.10 (Final)
- PHP 5.3.3 (cli) (built: Nov 1 2019 12:28:08)
- Apache/2.2.15 (Unix)
- mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
- Obsolete, at EOL
- Holds all OLD client authentication information- Holds all OLD client contact information
- Hold all OLD client order history
- On server soon to be de-commissioned
- Needed for internal reference purposes (some customers order only 1x per year)
NEW:
- CentOS Linux release 7.7.1908 (Core)
- A CUSTOM INSTALLED PHP 7.1.33 (cli) (built: Oct 25 2019 01:51:40) ( NTS )
- Server version: Apache/2.4.6 (CentOS)
- mysql Ver 5.5.64-MariaDB for Linux on x86_64 (MariaDB Server)
- Current, not at EOL (at least for a couple more years)
- Holds all OLD and NEW client authentication information (excepting passwords)- Holds all OLD and NEW client contact information
- Holds all NEW client order history, but does NOT hold OLD client order history
- Cannot accept OLD server order history (product ID's are different)
The CUSTOM INSTALLED PHP 7.1.33 happened because I had to manually upgrade the PHP version on my new server to run more modern websites, so I upgraded it post-installation. CentOS 7 normally installs PHP 5.4, which simply wasn't modern enough for some of the websites I installed.
PHP is now a far more strict programming language than it was in the old days. Here's a sample of what happened when I tried to run our Drupal 6 eCommerce website (written against PHP 5) in a PHP 7 environment:
[Tue Nov 26 22:26:43.296914 2019] [php7:error] [pid 26555] [client 103.11.143.20:58276] PHP Fatal error: 'break' not in the 'loop' or 'switch' context in <drupal_root>/sites/all/modules/imageapi/imageapi_gd.module on line 335
[Tue Nov 26 22:31:29.255885 2019] [php7:warn] [pid 26545] [client 14.0.153.23:25162] PHP Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in <drupal_root>/includes/unicode.inc on line 349
[Tue Nov 26 22:31:29.445122 2019] [php7:error] [pid 26545] [client 14.0.153.23:25162] PHP Fatal error: Uncaught Error: Call to undefined function ereg() in <drupal_root>/includes/file.inc:1085\nStack trace:\n#0 /var/www/vhosts/holisticpethelp.com/legacy/content/includes/common.inc(2914): file_scan_directory('sites/all/modul...', '.theme.inc$', Array, 0, true, 'name', 0)\n#1 <drupal_root>/sites/all/modules/ctools/ctools.module(236): drupal_system_listing('.theme.inc$', 'sites/all/modul...', 'name', 0)\n#2 <drupal_root>/sites/all/modules/ctools/ctools.module(304): _ctools_passthrough(Array, 'theme')\n#3 <drupal_root>/includes/theme.inc(278): ctools_theme(Array, 'module', 'ctools', 'sites/all/modul...')\n#4 <drupal_root>/includes/theme.inc(433): _theme_process_registry(Array, 'ctools', 'module', 'ctools', 'sites/all/modul...')\n#5 <drupal_root>/includes/theme.inc(237): _theme_build_registry(Object(stdC in <drupal_root>/includes/file.inc on line 1085
Now, if I was feeling super brave, I could have hunted down each of these errors and fixed them one-by-one - and maybe in the end have gotten our Drupal 6 code running in a PHP 7 environment. But then, I would still have that Drupal 6 End Of Life issue to deal with:
So, while fixing Drupal 6 to run on a more modern version of PHP might look like an interesting and fun thing to do, it also looked like a lot of work that just led to a lot more work.
The real answer - at least to me - seemed to be to figure out how to upgrade to the most mature, stable and well-developed next version of Drupal that offered an "in system" upgrade path within the Drupal family of versions from that point thereafter. My final analysis was that Drupal 7 was the version that met all of these criteria, because it was the oldest, best developed (but still supported) version of Drupal available at the time.
Here's what drupal.org has to say about moving between major Drupal versions:
As part of the refocus to mobile, we also took the opportunity to completely audit and refresh our website in terms of product, descriptions, images and videos. We took the time to basically revamp our eCommerce presence from top to bottom. Our eCommerce presence became a LOT BETTER as a result of the scrutiny and focus.
We got the new mobile-centric eCommerce website was up and running in under a week, but we kept the old website running in parallel for over a month, because it was still the #1 website that our clients used, and we wanted to offer them as much continuity and time to transition comfortably as possible. Every day, they continued to post orders at the old website, and we didn't want to disrupt that.
The only things we changed were the following:
1) All of our advertisements directed new customers to the new website
2) We changed the JOIN button on our old website to re-direct to the new website.
With all of that in place, the next thing to do was to figure out How To Run Multiple PHP Versions On The Same CentOS 7 Web Server.
Add Functionality Via Specialized Repositories
Because Getting Multiple PHP Versions To Run On The Same CentOS 7 Web Server requires access to a set of specialized software repositories that may or may not be natively offered by CentOS, the first thing we need to do is make sure that yum can find the components we need. They are:- Redhat Package Manager GNU Privacy Guard Keys (rpm-gpg)
- Extra Packages for Enterprise Linux (EPEL)
- Development Tools Group
- yum-utils
- The REMI Repository (to get diffferent versions of PHP)
Redhat Package Manager (RPM) GNU Privacy Guard (GPG) Encryption Keys:
Here's how to import the Redhat Package Manager (RPM) GNU Privacy Guard (GPG) Keys that will be needed to validate some of the packages we are going to need to add to the system.The keys are located in the /etc/pki/rpm-gpg directory:
# cd /etc/pki/rpm-gpg
# ls -lZ
-rw-r--r--. root root system_u:object_r:cert_t:s0 RPM-GPG-KEY-CentOS-7
-rw-r--r--. root root system_u:object_r:cert_t:s0 RPM-GPG-KEY-CentOS-Debug-7
-rw-r--r--. root root system_u:object_r:cert_t:s0 RPM-GPG-KEY-CentOS-SIG-SCLo
-rw-r--r--. root root system_u:object_r:cert_t:s0 RPM-GPG-KEY-CentOS-Testing-7
-rw-r--r--. root root system_u:object_r:cert_t:s0 RPM-GPG-KEY-EPEL-7
-rw-r--r--. root root system_u:object_r:cert_t:s0 RPM-GPG-KEY-IUS-7
OK, we know what we will be processing now, so it's time to issue an rpm command:
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
Don't be alarmed if you see no output from this rpm command. There should be some kind of output, but there isn't any, even if you use the -v or the --verbose option of the rpm command (sadly).
This step is complete.
Extra Packages for Enterprise Linux (EPEL) Repository
Here's how to gain access to the Extra Packages for Enterprise Linux (EPEL) Repository, which may not have been installed as part of your base CentOS installation, and which are going to be needed for this exercise:
# yum install -y epel-release
Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile
* base: mirror.qoxy.com
* centos-sclo-rh: mirror.qoxy.com
* epel: my.fedora.ipserverone.com
* extras: mirror.qoxy.com
* updates: mirror.qoxy.com
Package epel-release-7-12.noarch already installed and latest version
Nothing to do
This step is complete.
Development Tools Group
Here's how to install is the Development Tools Group, which holds things like compilers, debuggers and make utilities. I am not entirely sure this is required by this installation, but I am including it because these tools are ultimately quite useful, and disk space is now so cheap their addition really won't matter.First, check to see if it is accessible:
# yum group list
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirror.qoxy.com
* centos-sclo-rh: mirror.qoxy.com
* epel: my.fedora.ipserverone.com
* extras: mirror.qoxy.com
* updates: mirror.qoxy.com
Available Environment Groups:
Minimal Install
Compute Node
Infrastructure Server
File and Print Server
Cinnamon Desktop
MATE Desktop
Basic Web Server
Virtualization Host
Server with GUI
GNOME Desktop
KDE Plasma Workspaces
Development and Creative Workstation
Available Groups:
Cinnamon
Compatibility Libraries
Console Internet Tools
Development Tools
Educational Software
Electronic Lab
Fedora Packager
General Purpose Desktop
Graphical Administration Tools
Haskell
LXQt Desktop
Legacy UNIX Compatibility
MATE
Milkymist
Scientific Support
Security Tools
Smart Card Support
System Administration Tools
System Management
TurboGears application framework
Xfce
Done
The following command will install a bunch of packages on your machine (in my case, 58 of them), so just sit back and wait for the transaction to finish, and the word Complete! to appear, which means everything installed OK.
# yum -v groupinstall 'Development Tools'
Loaded plugins: fastestmirror.
.
.
Complete!
This step is complete.
Install the yum-utils package:
Here's how to install the yum-utils package, which is a collection of tools and utilities for managing yum (Yellowdog Updater Modified) repositories. Again, I am really not certain this is required, but these tools are also handy to have around.# yum -y install yum-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.qoxy.com
* centos-sclo-rh: mirror.qoxy.com
* epel: my.fedora.ipserverone.com
* extras: mirror.qoxy.com
* updates: mirror.qoxy.com
Package yum-utils-1.1.31-52.el7.noarch already installed and latest version
Nothing to do
This step is complete.
Enable and Install the Remi Collet (REMI) Repository & PHP-FPM Packages:
Remi Collet is a treasure to the CentOS community. He maintains a repository of software that has been prepared for installation on different versions of Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux.Here's how to activate access to the REMI Repository:
# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Loaded plugins: fastestmirror
remi-release-7.rpm .
.
.
Complete!
Next, we need to make sure that the REMI Repository is available to CentOS 7:
# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.qoxy.com
* centos-sclo-rh: mirror.qoxy.com
* centos-sclo-sclo: mirror.qoxy.com
* epel: epel.mirror.angkasa.id
* extras: mirror.qoxy.com
* remi-php71: mirrors.thzhost.com
* remi-safe: mirrors.thzhost.com
* updates: mirror.qoxy.com
remi-php71 | 3.0 kB 00:00:00
remi-safe | 3.0 kB 00:00:00
(1/2): remi-php71/primary_db | 242 kB 00:00:00
(2/2): remi-safe/primary_db | 1.6 MB 00:00:01
repo id repo name status
Webmin Webmin Distribution Neutral 146
base/7/x86_64 CentOS-7 - Base 10,097
centos-sclo-rh/x86_64 CentOS-7 - SCLo rh 8,763
centos-sclo-sclo/x86_64 CentOS-7 - SCLo sclo 830
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,476
extras/7/x86_64 CentOS-7 - Extras 305
ius/x86_64 IUS for Enterprise Linux 7 - x86_64 637
remi-php71 Remi's PHP 7.1 RPM repository for Enterprise Linux 7 - x86_64 427
remi-safe Safe Remi's RPM repository for Enterprise Linux 7 - x86_64 3,621
updates/7/x86_64 CentOS-7 - Updates 738
repolist: 39,040
OK, so now that we know the REMI Repository is available, we can use it to go and get the different versions of PHP that we need.
NOTE: For the sake of simplicity, I am going to take a chance and hope that PHP 5.6 is not going to significantly break my OLD website (PHP 5.3.3).
NOTE: For the sake of simplicity, I am going to take a chance and hope that PHP 5.6 is not going to significantly break my OLD website (PHP 5.3.3).
So the versions of PHP I want to install on the server are:
- PHP 5.6 (OLD website, of which there is only one)
- PHP 7.1 (NEW website + all other websites on this server)
Alright, let's start by installing PHP 7.1 on the server, because that's what my production website is running and what almost all of my other websites require.
First - How To Remove php71u From a CentOS 7 Server
To remove php71u from a CentOS 7 Server, you need to find the packages that were installed in its name. Here's how I found them:
# rpm -qa | grep -i php71u
php71u-cli-7.1.33-1.el7.ius.x86_64
php71u-mbstring-7.1.33-1.el7.ius.x86_64
php71u-pdo-7.1.33-1.el7.ius.x86_64
php71u-fpm-7.1.33-1.el7.ius.x86_64
php71u-process-7.1.33-1.el7.ius.x86_64
php71u-gd-7.1.33-1.el7.ius.x86_64
php71u-mysqlnd-7.1.33-1.el7.ius.x86_64
mod_php71u-7.1.33-1.el7.ius.x86_64
php71u-bcmath-7.1.33-1.el7.ius.x86_64
php71u-opcache-7.1.33-1.el7.ius.x86_64
php71u-pecl-igbinary-3.0.1-1.el7.ius.x86_64
php71u-pecl-memcached-3.1.4-1.el7.ius.x86_64
php71u-intl-7.1.33-1.el7.ius.x86_64
php71u-json-7.1.33-1.el7.ius.x86_64
php71u-xml-7.1.33-1.el7.ius.x86_64
php71u-common-7.1.33-1.el7.ius.x86_64
OK, now that we know what packages were installed, we can remove them all via a single yum command. Because php71u is the default PHP server right now, it can be removed by simply specifying "php" in the yum command:
# yum remove php*
# yum remove php*
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package php71u-bcmath.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-cli.x86_64 0:7.1.33-1.el7.ius will be erased
--> Processing Dependency: php-cli for package: 1:pear1-1.10.9-3.el7.ius.noarch
---> Package php71u-common.x86_64 0:7.1.33-1.el7.ius will be erased
--> Processing Dependency: php-common(x86-64) = 7.1.33-1.el7.ius for package: mod_php71u-7.1.33-1.el7.ius.x86_64
---> Package php71u-fpm.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-gd.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-intl.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-json.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-mbstring.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-mysqlnd.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-opcache.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-pdo.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-pecl-igbinary.x86_64 0:3.0.1-1.el7.ius will be erased
---> Package php71u-pecl-memcached.x86_64 0:3.1.4-1.el7.ius will be erased
---> Package php71u-process.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-xml.x86_64 0:7.1.33-1.el7.ius will be erased
--> Running transaction check
---> Package mod_php71u.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package pear1.noarch 1:1.10.9-3.el7.ius will be erased
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================
Removing:
php71u-bcmath x86_64 7.1.33-1.el7.ius @ius 94 k
php71u-cli x86_64 7.1.33-1.el7.ius @ius 14 M
php71u-common x86_64 7.1.33-1.el7.ius @ius 8.2 M
php71u-fpm x86_64 7.1.33-1.el7.ius @ius 4.6 M
php71u-gd x86_64 7.1.33-1.el7.ius @ius 749 k
php71u-intl x86_64 7.1.33-1.el7.ius @ius 934 k
php71u-json x86_64 7.1.33-1.el7.ius @ius 80 k
php71u-mbstring x86_64 7.1.33-1.el7.ius @ius 2.8 M
php71u-mysqlnd x86_64 7.1.33-1.el7.ius @ius 850 k
php71u-opcache x86_64 7.1.33-1.el7.ius @ius 791 k
php71u-pdo x86_64 7.1.33-1.el7.ius @ius 382 k
php71u-pecl-igbinary x86_64 3.0.1-1.el7.ius @ius 368 k
php71u-pecl-memcached x86_64 3.1.4-1.el7.ius @ius 336 k
php71u-process x86_64 7.1.33-1.el7.ius @ius 180 k
php71u-xml x86_64 7.1.33-1.el7.ius @ius 851 k
Removing for dependencies:
mod_php71u x86_64 7.1.33-1.el7.ius @ius 9.2 M
pear1 noarch 1:1.10.9-3.el7.ius @ius 2.1 M
Transaction Summary
===========================================================================================================================================================
Remove 15 Packages (+2 Dependent packages)
Installed size: 46 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : 1:pear1-1.10.9-3.el7.ius.noarch 1/17
Erasing : php71u-pecl-memcached-3.1.4-1.el7.ius.x86_64 2/17
Erasing : php71u-json-7.1.33-1.el7.ius.x86_64 3/17
Erasing : php71u-pecl-igbinary-3.0.1-1.el7.ius.x86_64 4/17
Erasing : php71u-cli-7.1.33-1.el7.ius.x86_64 5/17
Erasing : php71u-process-7.1.33-1.el7.ius.x86_64 6/17
Erasing : php71u-xml-7.1.33-1.el7.ius.x86_64 7/17
Erasing : php71u-mbstring-7.1.33-1.el7.ius.x86_64 8/17
Erasing : php71u-bcmath-7.1.33-1.el7.ius.x86_64 9/17
Erasing : php71u-opcache-7.1.33-1.el7.ius.x86_64 10/17
Erasing : php71u-mysqlnd-7.1.33-1.el7.ius.x86_64 11/17
Erasing : php71u-pdo-7.1.33-1.el7.ius.x86_64 12/17
Erasing : php71u-fpm-7.1.33-1.el7.ius.x86_64 13/17
Erasing : php71u-gd-7.1.33-1.el7.ius.x86_64 14/17
Erasing : php71u-intl-7.1.33-1.el7.ius.x86_64 15/17
Erasing : mod_php71u-7.1.33-1.el7.ius.x86_64 16/17
Erasing : php71u-common-7.1.33-1.el7.ius.x86_64 17/17
Verifying : mod_php71u-7.1.33-1.el7.ius.x86_64 1/17
Verifying : 1:pear1-1.10.9-3.el7.ius.noarch 2/17
Verifying : php71u-json-7.1.33-1.el7.ius.x86_64 3/17
Verifying : php71u-intl-7.1.33-1.el7.ius.x86_64 4/17
Verifying : php71u-gd-7.1.33-1.el7.ius.x86_64 5/17
Verifying : php71u-fpm-7.1.33-1.el7.ius.x86_64 6/17
Verifying : php71u-mysqlnd-7.1.33-1.el7.ius.x86_64 7/17
Verifying : php71u-pecl-memcached-3.1.4-1.el7.ius.x86_64 8/17
Verifying : php71u-cli-7.1.33-1.el7.ius.x86_64 9/17
Verifying : php71u-xml-7.1.33-1.el7.ius.x86_64 10/17
Verifying : php71u-process-7.1.33-1.el7.ius.x86_64 11/17
Verifying : php71u-pecl-igbinary-3.0.1-1.el7.ius.x86_64 12/17
Verifying : php71u-opcache-7.1.33-1.el7.ius.x86_64 13/17
Verifying : php71u-bcmath-7.1.33-1.el7.ius.x86_64 14/17
Verifying : php71u-pdo-7.1.33-1.el7.ius.x86_64 15/17
Verifying : php71u-mbstring-7.1.33-1.el7.ius.x86_64 16/17
Verifying : php71u-common-7.1.33-1.el7.ius.x86_64 17/17
Removed:
php71u-bcmath.x86_64 0:7.1.33-1.el7.ius php71u-cli.x86_64 0:7.1.33-1.el7.ius php71u-common.x86_64 0:7.1.33-1.el7.ius
php71u-fpm.x86_64 0:7.1.33-1.el7.ius php71u-gd.x86_64 0:7.1.33-1.el7.ius php71u-intl.x86_64 0:7.1.33-1.el7.ius
php71u-json.x86_64 0:7.1.33-1.el7.ius php71u-mbstring.x86_64 0:7.1.33-1.el7.ius php71u-mysqlnd.x86_64 0:7.1.33-1.el7.ius
php71u-opcache.x86_64 0:7.1.33-1.el7.ius php71u-pdo.x86_64 0:7.1.33-1.el7.ius php71u-pecl-igbinary.x86_64 0:3.0.1-1.el7.ius
php71u-pecl-memcached.x86_64 0:3.1.4-1.el7.ius php71u-process.x86_64 0:7.1.33-1.el7.ius php71u-xml.x86_64 0:7.1.33-1.el7.ius
Dependency Removed:
mod_php71u.x86_64 0:7.1.33-1.el7.ius pear1.noarch 1:1.10.9-3.el7.ius
Complete!
# yum remove php*
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package php71u-bcmath.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-cli.x86_64 0:7.1.33-1.el7.ius will be erased
--> Processing Dependency: php-cli for package: 1:pear1-1.10.9-3.el7.ius.noarch
---> Package php71u-common.x86_64 0:7.1.33-1.el7.ius will be erased
--> Processing Dependency: php-common(x86-64) = 7.1.33-1.el7.ius for package: mod_php71u-7.1.33-1.el7.ius.x86_64
---> Package php71u-fpm.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-gd.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-intl.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-json.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-mbstring.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-mysqlnd.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-opcache.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-pdo.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-pecl-igbinary.x86_64 0:3.0.1-1.el7.ius will be erased
---> Package php71u-pecl-memcached.x86_64 0:3.1.4-1.el7.ius will be erased
---> Package php71u-process.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package php71u-xml.x86_64 0:7.1.33-1.el7.ius will be erased
--> Running transaction check
---> Package mod_php71u.x86_64 0:7.1.33-1.el7.ius will be erased
---> Package pear1.noarch 1:1.10.9-3.el7.ius will be erased
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================
Removing:
php71u-bcmath x86_64 7.1.33-1.el7.ius @ius 94 k
php71u-cli x86_64 7.1.33-1.el7.ius @ius 14 M
php71u-common x86_64 7.1.33-1.el7.ius @ius 8.2 M
php71u-fpm x86_64 7.1.33-1.el7.ius @ius 4.6 M
php71u-gd x86_64 7.1.33-1.el7.ius @ius 749 k
php71u-intl x86_64 7.1.33-1.el7.ius @ius 934 k
php71u-json x86_64 7.1.33-1.el7.ius @ius 80 k
php71u-mbstring x86_64 7.1.33-1.el7.ius @ius 2.8 M
php71u-mysqlnd x86_64 7.1.33-1.el7.ius @ius 850 k
php71u-opcache x86_64 7.1.33-1.el7.ius @ius 791 k
php71u-pdo x86_64 7.1.33-1.el7.ius @ius 382 k
php71u-pecl-igbinary x86_64 3.0.1-1.el7.ius @ius 368 k
php71u-pecl-memcached x86_64 3.1.4-1.el7.ius @ius 336 k
php71u-process x86_64 7.1.33-1.el7.ius @ius 180 k
php71u-xml x86_64 7.1.33-1.el7.ius @ius 851 k
Removing for dependencies:
mod_php71u x86_64 7.1.33-1.el7.ius @ius 9.2 M
pear1 noarch 1:1.10.9-3.el7.ius @ius 2.1 M
Transaction Summary
===========================================================================================================================================================
Remove 15 Packages (+2 Dependent packages)
Installed size: 46 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : 1:pear1-1.10.9-3.el7.ius.noarch 1/17
Erasing : php71u-pecl-memcached-3.1.4-1.el7.ius.x86_64 2/17
Erasing : php71u-json-7.1.33-1.el7.ius.x86_64 3/17
Erasing : php71u-pecl-igbinary-3.0.1-1.el7.ius.x86_64 4/17
Erasing : php71u-cli-7.1.33-1.el7.ius.x86_64 5/17
Erasing : php71u-process-7.1.33-1.el7.ius.x86_64 6/17
Erasing : php71u-xml-7.1.33-1.el7.ius.x86_64 7/17
Erasing : php71u-mbstring-7.1.33-1.el7.ius.x86_64 8/17
Erasing : php71u-bcmath-7.1.33-1.el7.ius.x86_64 9/17
Erasing : php71u-opcache-7.1.33-1.el7.ius.x86_64 10/17
Erasing : php71u-mysqlnd-7.1.33-1.el7.ius.x86_64 11/17
Erasing : php71u-pdo-7.1.33-1.el7.ius.x86_64 12/17
Erasing : php71u-fpm-7.1.33-1.el7.ius.x86_64 13/17
Erasing : php71u-gd-7.1.33-1.el7.ius.x86_64 14/17
Erasing : php71u-intl-7.1.33-1.el7.ius.x86_64 15/17
Erasing : mod_php71u-7.1.33-1.el7.ius.x86_64 16/17
Erasing : php71u-common-7.1.33-1.el7.ius.x86_64 17/17
Verifying : mod_php71u-7.1.33-1.el7.ius.x86_64 1/17
Verifying : 1:pear1-1.10.9-3.el7.ius.noarch 2/17
Verifying : php71u-json-7.1.33-1.el7.ius.x86_64 3/17
Verifying : php71u-intl-7.1.33-1.el7.ius.x86_64 4/17
Verifying : php71u-gd-7.1.33-1.el7.ius.x86_64 5/17
Verifying : php71u-fpm-7.1.33-1.el7.ius.x86_64 6/17
Verifying : php71u-mysqlnd-7.1.33-1.el7.ius.x86_64 7/17
Verifying : php71u-pecl-memcached-3.1.4-1.el7.ius.x86_64 8/17
Verifying : php71u-cli-7.1.33-1.el7.ius.x86_64 9/17
Verifying : php71u-xml-7.1.33-1.el7.ius.x86_64 10/17
Verifying : php71u-process-7.1.33-1.el7.ius.x86_64 11/17
Verifying : php71u-pecl-igbinary-3.0.1-1.el7.ius.x86_64 12/17
Verifying : php71u-opcache-7.1.33-1.el7.ius.x86_64 13/17
Verifying : php71u-bcmath-7.1.33-1.el7.ius.x86_64 14/17
Verifying : php71u-pdo-7.1.33-1.el7.ius.x86_64 15/17
Verifying : php71u-mbstring-7.1.33-1.el7.ius.x86_64 16/17
Verifying : php71u-common-7.1.33-1.el7.ius.x86_64 17/17
Removed:
php71u-bcmath.x86_64 0:7.1.33-1.el7.ius php71u-cli.x86_64 0:7.1.33-1.el7.ius php71u-common.x86_64 0:7.1.33-1.el7.ius
php71u-fpm.x86_64 0:7.1.33-1.el7.ius php71u-gd.x86_64 0:7.1.33-1.el7.ius php71u-intl.x86_64 0:7.1.33-1.el7.ius
php71u-json.x86_64 0:7.1.33-1.el7.ius php71u-mbstring.x86_64 0:7.1.33-1.el7.ius php71u-mysqlnd.x86_64 0:7.1.33-1.el7.ius
php71u-opcache.x86_64 0:7.1.33-1.el7.ius php71u-pdo.x86_64 0:7.1.33-1.el7.ius php71u-pecl-igbinary.x86_64 0:3.0.1-1.el7.ius
php71u-pecl-memcached.x86_64 0:3.1.4-1.el7.ius php71u-process.x86_64 0:7.1.33-1.el7.ius php71u-xml.x86_64 0:7.1.33-1.el7.ius
Dependency Removed:
mod_php71u.x86_64 0:7.1.33-1.el7.ius pear1.noarch 1:1.10.9-3.el7.ius
Complete!
How To Install PHP 7.1 Using the REMI Repository
To install PHP 7.1 as the default PHP version on CentOS, the system must be informed that the version of PHP on the machine has been changed away from whatever the previous default installation version may have been. This is done with the yum-config-manager command:# yum-config-manager --enable remi-php71
Loaded plugins: fastestmirror
==================================================================== repo: remi-php71 =====================================================================
[remi-php71]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl =
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php71
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php71/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php71/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php71/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist = http://cdn.remirepo.net/enterprise/7/php71/mirror
mirrorlist_expire = 86400
name = Remi's PHP 7.1 RPM repository for Enterprise Linux 7 - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php71
pkgdir = /var/cache/yum/x86_64/7/remi-php71/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php71
ui_repoid_vars = releasever,basearch
username =
# yum install php php-common php-fpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.qoxy.com
* centos-sclo-rh: mirror.qoxy.com
* centos-sclo-sclo: mirror.qoxy.com
* epel: my.fedora.ipserverone.com
* extras: mirror.qoxy.com
* remi-php71: mirror.innosol.asia
* remi-safe: mirror.innosol.asia
* updates: mirror.qoxy.com
remi-php71 | 3.0 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:7.1.33-1.el7.remi will be installed
--> Processing Dependency: php-cli(x86-64) = 7.1.33-1.el7.remi for package: php-7.1.33-1.el7.remi.x86_64
---> Package php-common.x86_64 0:7.1.33-1.el7.remi will be installed
--> Processing Dependency: php-json(x86-64) = 7.1.33-1.el7.remi for package: php-common-7.1.33-1.el7.remi.x86_64
---> Package php-fpm.x86_64 0:7.1.33-1.el7.remi will be installed
--> Running transaction check
---> Package php-cli.x86_64 0:7.1.33-1.el7.remi will be installed
---> Package php-json.x86_64 0:7.1.33-1.el7.remi will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================
Installing:
php x86_64 7.1.33-1.el7.remi remi-php71 3.0 M
php-common x86_64 7.1.33-1.el7.remi remi-php71 1.0 M
php-fpm x86_64 7.1.33-1.el7.remi remi-php71 1.6 M
Installing for dependencies:
php-cli x86_64 7.1.33-1.el7.remi remi-php71 4.6 M
php-json x86_64 7.1.33-1.el7.remi remi-php71 62 k
Transaction Summary
===========================================================================================================================================================
Install 3 Packages (+2 Dependent packages)
Total download size: 10 M
Installed size: 36 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/remi-php71/packages/php-common-7.1.33-1.el7.remi.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY-:-- ETA
Public key for php-common-7.1.33-1.el7.remi.x86_64.rpm is not installed
(1/5): php-common-7.1.33-1.el7.remi.x86_64.rpm | 1.0 MB 00:00:00
(2/5): php-json-7.1.33-1.el7.remi.x86_64.rpm | 62 kB 00:00:01
(3/5): php-7.1.33-1.el7.remi.x86_64.rpm | 3.0 MB 00:00:02
(4/5): php-fpm-7.1.33-1.el7.remi.x86_64.rpm | 1.6 MB 00:00:03
(5/5): php-cli-7.1.33-1.el7.remi.x86_64.rpm | 4.6 MB 00:00:03
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Total 3.0 MB/s | 10 MB 00:00:03
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Importing GPG key 0x00F97F56:
Userid : "Remi Collet <RPMS@FamilleCollet.com>"
Fingerprint: 1ee0 4cce 88a4 ae4a a29a 5df5 004e 6f47 00f9 7f56
Package : remi-release-7.7-1.el7.remi.noarch (@/remi-release-7)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : php-common-7.1.33-1.el7.remi.x86_64 1/5
Installing : php-json-7.1.33-1.el7.remi.x86_64 2/5
Installing : php-cli-7.1.33-1.el7.remi.x86_64 3/5
Installing : php-7.1.33-1.el7.remi.x86_64 4/5
Installing : php-fpm-7.1.33-1.el7.remi.x86_64 5/5
Verifying : php-json-7.1.33-1.el7.remi.x86_64 1/5
Verifying : php-7.1.33-1.el7.remi.x86_64 2/5
Verifying : php-common-7.1.33-1.el7.remi.x86_64 3/5
Verifying : php-fpm-7.1.33-1.el7.remi.x86_64 4/5
Verifying : php-cli-7.1.33-1.el7.remi.x86_64 5/5
Installed:
php.x86_64 0:7.1.33-1.el7.remi php-common.x86_64 0:7.1.33-1.el7.remi php-fpm.x86_64 0:7.1.33-1.el7.remi
Dependency Installed:
php-cli.x86_64 0:7.1.33-1.el7.remi php-json.x86_64 0:7.1.33-1.el7.remi
Complete!
Once the base PHP 7.1 system has been put into place, the rest of the components can be installed via the yum command:
# yum install php-mysql php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.qoxy.com
* centos-sclo-rh: mirror.qoxy.com
* centos-sclo-sclo: mirror.qoxy.com
* epel: my.fedora.ipserverone.com
* extras: mirror.qoxy.com
* remi-php71: mirrors.thzhost.com
* remi-safe: mirrors.thzhost.com
* updates: mirror.qoxy.com
Package php-mysql is obsoleted by php-mysqlnd, trying to install php-mysqlnd-7.1.33-1.el7.remi.x86_64 instead
Package php-cli-7.1.33-1.el7.remi.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package php-gd.x86_64 0:7.1.33-1.el7.remi will be installed
--> Processing Dependency: gd-last(x86-64) >= 2.1.1 for package: php-gd-7.1.33-1.el7.remi.x86_64
--> Processing Dependency: libgd.so.3()(64bit) for package: php-gd-7.1.33-1.el7.remi.x86_64
---> Package php-mbstring.x86_64 0:7.1.33-1.el7.remi will be installed
---> Package php-mcrypt.x86_64 0:7.1.33-1.el7.remi will be installed
--> Processing Dependency: libltdl.so.7()(64bit) for package: php-mcrypt-7.1.33-1.el7.remi.x86_64
--> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt-7.1.33-1.el7.remi.x86_64
---> Package php-mysqlnd.x86_64 0:7.1.33-1.el7.remi will be installed
---> Package php-pdo.x86_64 0:7.1.33-1.el7.remi will be installed
---> Package php-pear.noarch 1:1.10.10-2.el7.remi will be installed
--> Processing Dependency: php-composer(fedora/autoloader) for package: 1:php-pear-1.10.10-2.el7.remi.noarch
--> Processing Dependency: php-posix for package: 1:php-pear-1.10.10-2.el7.remi.noarch
---> Package php-pecl-apcu-bc.x86_64 0:1.0.5-1.el7.remi.7.1 will be installed
--> Processing Dependency: php-pecl-apcu(x86-64) >= 5.1.2 for package: php-pecl-apcu-bc-1.0.5-1.el7.remi.7.1.x86_64
---> Package php-pecl-memcache.x86_64 0:4.0.4-1.el7.remi.7.1 will be installed
---> Package php-pecl-memcached.x86_64 0:3.1.4-1.el7.remi.7.1 will be installed
--> Processing Dependency: libmemcached-opt-libs(x86-64) for package: php-pecl-memcached-3.1.4-1.el7.remi.7.1.x86_64
--> Processing Dependency: php-pecl-igbinary(x86-64) for package: php-pecl-memcached-3.1.4-1.el7.remi.7.1.x86_64
--> Processing Dependency: php-pecl-msgpack(x86-64) for package: php-pecl-memcached-3.1.4-1.el7.remi.7.1.x86_64
---> Package php-xml.x86_64 0:7.1.33-1.el7.remi will be installed
--> Running transaction check
---> Package gd-last.x86_64 0:2.2.5-10.el7.remi will be installed
--> Processing Dependency: libwebp.so.7()(64bit) for package: gd-last-2.2.5-10.el7.remi.x86_64
---> Package libmcrypt.x86_64 0:2.5.8-13.el7 will be installed
---> Package libmemcached-opt-libs.x86_64 0:1.0.18-2.el7.remi will be installed
---> Package libtool-ltdl.x86_64 0:2.4.2-22.el7_3 will be installed
---> Package php-fedora-autoloader.noarch 0:1.0.0-1.el7 will be installed
---> Package php-pecl-apcu.x86_64 0:5.1.18-1.el7.remi.7.1 will be installed
---> Package php-pecl-igbinary.x86_64 0:3.0.1-1.el7.remi.7.1 will be installed
---> Package php-pecl-msgpack.x86_64 0:2.0.3-1.el7.remi.7.1 will be installed
---> Package php-process.x86_64 0:7.1.33-1.el7.remi will be installed
--> Running transaction check
---> Package libwebp7.x86_64 0:1.0.2-1.el7.remi will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================
Installing:
php-gd x86_64 7.1.33-1.el7.remi remi-php71 76 k
php-mbstring x86_64 7.1.33-1.el7.remi remi-php71 580 k
php-mcrypt x86_64 7.1.33-1.el7.remi remi-php71 60 k
php-mysqlnd x86_64 7.1.33-1.el7.remi remi-php71 231 k
php-pdo x86_64 7.1.33-1.el7.remi remi-php71 125 k
php-pear noarch 1:1.10.10-2.el7.remi remi-php71 361 k
php-pecl-apcu-bc x86_64 1.0.5-1.el7.remi.7.1 remi-php71 17 k
php-pecl-memcache x86_64 4.0.4-1.el7.remi.7.1 remi-php71 88 k
php-pecl-memcached x86_64 3.1.4-1.el7.remi.7.1 remi-php71 87 k
php-xml x86_64 7.1.33-1.el7.remi remi-php71 210 k
Installing for dependencies:
gd-last x86_64 2.2.5-10.el7.remi remi-safe 134 k
libmcrypt x86_64 2.5.8-13.el7 epel 99 k
libmemcached-opt-libs x86_64 1.0.18-2.el7.remi remi-safe 127 k
libtool-ltdl x86_64 2.4.2-22.el7_3 base 49 k
libwebp7 x86_64 1.0.2-1.el7.remi remi-safe 265 k
php-fedora-autoloader noarch 1.0.0-1.el7 epel 9.6 k
php-pecl-apcu x86_64 5.1.18-1.el7.remi.7.1 remi-php71 75 k
php-pecl-igbinary x86_64 3.0.1-1.el7.remi.7.1 remi-php71 97 k
php-pecl-msgpack x86_64 2.0.3-1.el7.remi.7.1 remi-php71 54 k
php-process x86_64 7.1.33-1.el7.remi remi-php71 79 k
Transaction Summary
===========================================================================================================================================================
Install 10 Packages (+10 Dependent packages)
Total download size: 2.8 M
Installed size: 11 M
Is this ok [y/d/N]: y
Downloading packages:
(1/20): libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm | 49 kB 00:00:00
(2/20): libmcrypt-2.5.8-13.el7.x86_64.rpm | 99 kB 00:00:00
(3/20): libmemcached-opt-libs-1.0.18-2.el7.remi.x86_64.rpm | 127 kB 00:00:00
(4/20): php-fedora-autoloader-1.0.0-1.el7.noarch.rpm | 9.6 kB 00:00:00
(5/20): gd-last-2.2.5-10.el7.remi.x86_64.rpm | 134 kB 00:00:00
(6/20): php-mbstring-7.1.33-1.el7.remi.x86_64.rpm | 580 kB 00:00:00
(7/20): php-gd-7.1.33-1.el7.remi.x86_64.rpm | 76 kB 00:00:00
(8/20): php-pdo-7.1.33-1.el7.remi.x86_64.rpm | 125 kB 00:00:00
(9/20): php-pecl-apcu-5.1.18-1.el7.remi.7.1.x86_64.rpm | 75 kB 00:00:00
(10/20): php-pecl-apcu-bc-1.0.5-1.el7.remi.7.1.x86_64.rpm | 17 kB 00:00:00
(11/20): php-pecl-igbinary-3.0.1-1.el7.remi.7.1.x86_64.rpm | 97 kB 00:00:00
(12/20): php-pecl-memcache-4.0.4-1.el7.remi.7.1.x86_64.rpm | 88 kB 00:00:00
(13/20): php-pecl-memcached-3.1.4-1.el7.remi.7.1.x86_64.rpm | 87 kB 00:00:00
(14/20): php-pear-1.10.10-2.el7.remi.noarch.rpm | 361 kB 00:00:00
(15/20): php-pecl-msgpack-2.0.3-1.el7.remi.7.1.x86_64.rpm | 54 kB 00:00:00
(16/20): php-process-7.1.33-1.el7.remi.x86_64.rpm | 79 kB 00:00:00
(17/20): php-xml-7.1.33-1.el7.remi.x86_64.rpm | 210 kB 00:00:00
(18/20): libwebp7-1.0.2-1.el7.remi.x86_64.rpm | 265 kB 00:00:01
(19/20): php-mcrypt-7.1.33-1.el7.remi.x86_64.rpm | 60 kB 00:00:01
(20/20): php-mysqlnd-7.1.33-1.el7.remi.x86_64.rpm | 231 kB 00:00:01
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.1 MB/s | 2.8 MB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libmcrypt-2.5.8-13.el7.x86_64 1/20
Installing : php-pecl-msgpack-2.0.3-1.el7.remi.7.1.x86_64 2/20
Installing : libwebp7-1.0.2-1.el7.remi.x86_64 3/20
Installing : gd-last-2.2.5-10.el7.remi.x86_64 4/20
Installing : php-pecl-apcu-5.1.18-1.el7.remi.7.1.x86_64 5/20
Installing : php-fedora-autoloader-1.0.0-1.el7.noarch 6/20
Installing : php-process-7.1.33-1.el7.remi.x86_64 7/20
Installing : php-pdo-7.1.33-1.el7.remi.x86_64 8/20
Installing : php-pecl-igbinary-3.0.1-1.el7.remi.7.1.x86_64 9/20
Installing : libmemcached-opt-libs-1.0.18-2.el7.remi.x86_64 10/20
Installing : libtool-ltdl-2.4.2-22.el7_3.x86_64 11/20
Installing : php-xml-7.1.33-1.el7.remi.x86_64 12/20
Installing : 1:php-pear-1.10.10-2.el7.remi.noarch 13/20
Installing : php-mcrypt-7.1.33-1.el7.remi.x86_64 14/20
Installing : php-pecl-memcached-3.1.4-1.el7.remi.7.1.x86_64 15/20
Installing : php-mysqlnd-7.1.33-1.el7.remi.x86_64 16/20
Installing : php-pecl-apcu-bc-1.0.5-1.el7.remi.7.1.x86_64 17/20
Installing : php-gd-7.1.33-1.el7.remi.x86_64 18/20
Installing : php-mbstring-7.1.33-1.el7.remi.x86_64 19/20
Installing : php-pecl-memcache-4.0.4-1.el7.remi.7.1.x86_64 20/20
Verifying : php-pecl-memcache-4.0.4-1.el7.remi.7.1.x86_64 1/20
Verifying : gd-last-2.2.5-10.el7.remi.x86_64 2/20
Verifying : php-xml-7.1.33-1.el7.remi.x86_64 3/20
Verifying : libtool-ltdl-2.4.2-22.el7_3.x86_64 4/20
Verifying : libmemcached-opt-libs-1.0.18-2.el7.remi.x86_64 5/20
Verifying : 1:php-pear-1.10.10-2.el7.remi.noarch 6/20
Verifying : php-pecl-igbinary-3.0.1-1.el7.remi.7.1.x86_64 7/20
Verifying : php-gd-7.1.33-1.el7.remi.x86_64 8/20
Verifying : php-pdo-7.1.33-1.el7.remi.x86_64 9/20
Verifying : php-process-7.1.33-1.el7.remi.x86_64 10/20
Verifying : php-fedora-autoloader-1.0.0-1.el7.noarch 11/20
Verifying : php-pecl-apcu-5.1.18-1.el7.remi.7.1.x86_64 12/20
Verifying : php-mbstring-7.1.33-1.el7.remi.x86_64 13/20
Verifying : php-mcrypt-7.1.33-1.el7.remi.x86_64 14/20
Verifying : libwebp7-1.0.2-1.el7.remi.x86_64 15/20
Verifying : php-pecl-msgpack-2.0.3-1.el7.remi.7.1.x86_64 16/20
Verifying : php-mysqlnd-7.1.33-1.el7.remi.x86_64 17/20
Verifying : libmcrypt-2.5.8-13.el7.x86_64 18/20
Verifying : php-pecl-apcu-bc-1.0.5-1.el7.remi.7.1.x86_64 19/20
Verifying : php-pecl-memcached-3.1.4-1.el7.remi.7.1.x86_64 20/20
Installed:
php-gd.x86_64 0:7.1.33-1.el7.remi php-mbstring.x86_64 0:7.1.33-1.el7.remi php-mcrypt.x86_64 0:7.1.33-1.el7.remi
php-mysqlnd.x86_64 0:7.1.33-1.el7.remi php-pdo.x86_64 0:7.1.33-1.el7.remi php-pear.noarch 1:1.10.10-2.el7.remi
php-pecl-apcu-bc.x86_64 0:1.0.5-1.el7.remi.7.1 php-pecl-memcache.x86_64 0:4.0.4-1.el7.remi.7.1 php-pecl-memcached.x86_64 0:3.1.4-1.el7.remi.7.1
php-xml.x86_64 0:7.1.33-1.el7.remi
Dependency Installed:
gd-last.x86_64 0:2.2.5-10.el7.remi libmcrypt.x86_64 0:2.5.8-13.el7 libmemcached-opt-libs.x86_64 0:1.0.18-2.el7.remi
libtool-ltdl.x86_64 0:2.4.2-22.el7_3 libwebp7.x86_64 0:1.0.2-1.el7.remi php-fedora-autoloader.noarch 0:1.0.0-1.el7
php-pecl-apcu.x86_64 0:5.1.18-1.el7.remi.7.1 php-pecl-igbinary.x86_64 0:3.0.1-1.el7.remi.7.1 php-pecl-msgpack.x86_64 0:2.0.3-1.el7.remi.7.1
php-process.x86_64 0:7.1.33-1.el7.remi
Complete!
How To Test For A Working PHP 7.1 Installation
With REMI PHP 7.1 successfully installed, it's now time to re-start the apache server to see if there are any issues:
# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
First, we should check the status of the apache server to make sure that it is happy:
# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2019-11-27 19:53:27 HKT; 4s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 3679 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 3684 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─3684 /usr/sbin/httpd -DFOREGROUND
├─3685 /usr/sbin/httpd -DFOREGROUND
├─3686 /usr/sbin/httpd -DFOREGROUND
├─3687 /usr/sbin/httpd -DFOREGROUND
├─3688 /usr/sbin/httpd -DFOREGROUND
├─3689 /usr/sbin/httpd -DFOREGROUND
├─3690 /usr/sbin/httpd -DFOREGROUND
└─3692 /usr/sbin/httpd -DFOREGROUND
Nov 27 19:53:27 vm.yougrow.net systemd[1]: Starting The Apache HTTP Server...
Nov 27 19:53:27 vm.yougrow.net systemd[1]: Started The Apache HTTP Server.
The eCommerce website looks great - but warnings and errors are currently being hidden from users - how does the Drupal 7 Administrator GUI look?
No errors in the Drupal 7 Administration GUI either.
As a last check, let's investigate the PHP version offered up by the CentOS 7 CLI and Web interfaces:
How To Determine Current PHP version
There's a couple of ways to figure out what version of PHP is running on a CentOS server; One via the Command Line Interface (CLI) and another via the web interface using the phpinfo() command embedded in a very simple web page:The CLI Method:
# which php
/bin/php
# /bin/php -v
PHP 7.1.33 (cli) (built: Oct 25 2019 01:51:40) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies
[root@vm rpm-gpg]#
According to the Command Line Interface (CLI) of my CentOS 7 server, the version of PHP I am running is 7.1.33.
The phpinfo() Method:
<?php phpinfo(); ?>
Yes, it's a single line of code
Here's the result:
According to my CentOS 7 web server, the version of PHP I am now running is 7.1.33 , and I am using mod_php to process my PHP.
OK, looks like the PHP 7.1 installation was a great success!
But - What About The OLD eCommerce Website?
Enabling the REMI PHP 7.1 functionality is great for my NEW eCommerce website, which requires at least that version of PHP, but it is terrible for my OLD eCommerce website which requires at least PHP 5.3.3!How To Run Two Versions Of PHP On The Same CentOS 7 Server
Running Two Versions Of PHP On The Same CentOS Server requires a few modifications to the stock CentOS installation:
1) The default PHP version needs to be downloaded and installed on the server, along with its PHP-FastCGI Process Manager (php-fpm) component. In my case, the desired default is PHP 7.1
2) The alternate PHP version needs to be downloaded and installed on the server, along with its PHP-FastCGI Process Manager (php-fpm) component. In my case, the desired alternate is PHP 5.6
2) The alternate PHP version needs to be downloaded and installed on the server, along with its PHP-FastCGI Process Manager (php-fpm) component. In my case, the desired alternate is PHP 5.6
3) The php-fpm instance for PHP 7.1 needs to be bound to a different server port than the php-fpm instance for PHP 5.6
4) The apache server needs to have its configuration adjusted to use php-fpm instead of its default PHP processor, mod_php.
5) All of the apache website configuration files need to be adjusted so the server knows which website needs to be connected to which php-fpm instance
6) The apache server needs to be restarted
7) The new apache configuration needs to be tested and proven to be working using either the CLI or the WWW interface (ideally, both).
4) The php-fpm server ports for both PHP 7.1 and PHP 5.6 need to be unblocked by SELINUX
5) All of the apache website configuration files need to be adjusted so the server knows which website needs to be connected to which php-fpm instance
6) The apache server needs to be restarted
7) The new apache configuration needs to be tested and proven to be working using either the CLI or the WWW interface (ideally, both).
How To Install PHP 5.6 (REMI Repository Version)
Now that we have PHP 7.1 installed as the default PHP version on the CentOS 7 Server, we need to install a parallel PHP 5.6 version.Here's how to do that, using the REMI Repository:
# yum install php56 php56-php-common php56-php-fpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.qoxy.com
* centos-sclo-rh: mirror.qoxy.com
* centos-sclo-sclo: mirror.qoxy.com
* epel: my.fedora.ipserverone.com
* extras: mirror.qoxy.com
* remi-php54: mirrors.thzhost.com
* remi-php55: mirrors.thzhost.com
* remi-php56: mirrors.thzhost.com
* remi-php71: mirrors.thzhost.com
* remi-safe: mirrors.thzhost.com
* updates: mirror.qoxy.com
Resolving Dependencies
--> Running transaction check
---> Package php56.x86_64 0:3.0-1.el7.remi will be installed
--> Processing Dependency: php56-runtime(x86-64) = 3.0-1.el7.remi for package: php56-3.0-1.el7.remi.x86_64
--> Processing Dependency: php56-php-pear >= 1:1.10.5 for package: php56-3.0-1.el7.remi.x86_64
--> Processing Dependency: php56-runtime for package: php56-3.0-1.el7.remi.x86_64
--> Processing Dependency: php56-php-cli(x86-64) for package: php56-3.0-1.el7.remi.x86_64
---> Package php56-php-common.x86_64 0:5.6.40-14.el7.remi will be installed
--> Processing Dependency: php56-php-pecl-jsonc(x86-64) for package: php56-php-common-5.6.40-14.el7.remi.x86_64
--> Processing Dependency: php56-php-pecl-zip(x86-64) for package: php56-php-common-5.6.40-14.el7.remi.x86_64
---> Package php56-php-fpm.x86_64 0:5.6.40-14.el7.remi will be installed
--> Running transaction check
---> Package php56-php-cli.x86_64 0:5.6.40-14.el7.remi will be installed
---> Package php56-php-pear.noarch 1:1.10.10-2.el7.remi will be installed
--> Processing Dependency: php56-php-posix for package: 1:php56-php-pear-1.10.10-2.el7.remi.noarch
--> Processing Dependency: php56-php-xml for package: 1:php56-php-pear-1.10.10-2.el7.remi.noarch
---> Package php56-php-pecl-jsonc.x86_64 0:1.3.10-1.el7.remi will be installed
---> Package php56-php-pecl-zip.x86_64 0:1.15.5-1.el7.remi will be installed
---> Package php56-runtime.x86_64 0:3.0-1.el7.remi will be installed
--> Running transaction check
---> Package php56-php-process.x86_64 0:5.6.40-14.el7.remi will be installed
---> Package php56-php-xml.x86_64 0:5.6.40-14.el7.remi will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================
Installing:
php56 x86_64 3.0-1.el7.remi remi-safe 4.0 k
php56-php-common x86_64 5.6.40-14.el7.remi remi-safe 697 k
php56-php-fpm x86_64 5.6.40-14.el7.remi remi-safe 1.4 M
Installing for dependencies:
php56-php-cli x86_64 5.6.40-14.el7.remi remi-safe 2.6 M
php56-php-pear noarch 1:1.10.10-2.el7.remi remi-safe 362 k
php56-php-pecl-jsonc x86_64 1.3.10-1.el7.remi remi-safe 45 k
php56-php-pecl-zip x86_64 1.15.5-1.el7.remi remi-safe 45 k
php56-php-process x86_64 5.6.40-14.el7.remi remi-safe 66 k
php56-php-xml x86_64 5.6.40-14.el7.remi remi-safe 168 k
php56-runtime x86_64 3.0-1.el7.remi remi-safe 1.1 M
Transaction Summary
===========================================================================================================================================================
Install 3 Packages (+7 Dependent packages)
Total download size: 6.5 M
Installed size: 20 M
Is this ok [y/d/N]: y
Downloading packages:
(1/10): php56-3.0-1.el7.remi.x86_64.rpm | 4.0 kB 00:00:00
(2/10): php56-php-pecl-jsonc-1.3.10-1.el7.remi.x86_64.rpm | 45 kB 00:00:00
(3/10): php56-php-pecl-zip-1.15.5-1.el7.remi.x86_64.rpm | 45 kB 00:00:00
(4/10): php56-php-process-5.6.40-14.el7.remi.x86_64.rpm | 66 kB 00:00:00
(5/10): php56-php-xml-5.6.40-14.el7.remi.x86_64.rpm | 168 kB 00:00:00
(6/10): php56-runtime-3.0-1.el7.remi.x86_64.rpm | 1.1 MB 00:00:00
(7/10): php56-php-cli-5.6.40-14.el7.remi.x86_64.rpm | 2.6 MB 00:00:02
(8/10): php56-php-pear-1.10.10-2.el7.remi.noarch.rpm | 362 kB 00:00:02
(9/10): php56-php-common-5.6.40-14.el7.remi.x86_64.rpm | 697 kB 00:00:02
(10/10): php56-php-fpm-5.6.40-14.el7.remi.x86_64.rpm | 1.4 MB 00:00:03
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.9 MB/s | 6.5 MB 00:00:03
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : php56-runtime-3.0-1.el7.remi.x86_64 1/10
Installing : php56-php-pecl-jsonc-1.3.10-1.el7.remi.x86_64 2/10
Installing : php56-php-common-5.6.40-14.el7.remi.x86_64 3/10
Installing : php56-php-pecl-zip-1.15.5-1.el7.remi.x86_64 4/10
Installing : php56-php-cli-5.6.40-14.el7.remi.x86_64 5/10
Installing : php56-php-xml-5.6.40-14.el7.remi.x86_64 6/10
Installing : php56-php-process-5.6.40-14.el7.remi.x86_64 7/10
Installing : 1:php56-php-pear-1.10.10-2.el7.remi.noarch 8/10
Installing : php56-3.0-1.el7.remi.x86_64 9/10
Installing : php56-php-fpm-5.6.40-14.el7.remi.x86_64 10/10
=====================================================================
WARNING : PHP 5.6 have reached its "End of Life" in
January 2019. Even, if this package includes some of
the important security fix, backported from 7.1, the
UPGRADE to a maintained version is very strongly RECOMMENDED.
=====================================================================
Verifying : php56-php-xml-5.6.40-14.el7.remi.x86_64 1/10
Verifying : php56-3.0-1.el7.remi.x86_64 2/10
Verifying : php56-runtime-3.0-1.el7.remi.x86_64 3/10
Verifying : 1:php56-php-pear-1.10.10-2.el7.remi.noarch 4/10
Verifying : php56-php-process-5.6.40-14.el7.remi.x86_64 5/10
Verifying : php56-php-cli-5.6.40-14.el7.remi.x86_64 6/10
Verifying : php56-php-pecl-jsonc-1.3.10-1.el7.remi.x86_64 7/10
Verifying : php56-php-fpm-5.6.40-14.el7.remi.x86_64 8/10
Verifying : php56-php-common-5.6.40-14.el7.remi.x86_64 9/10
Verifying : php56-php-pecl-zip-1.15.5-1.el7.remi.x86_64 10/10
Installed:
php56.x86_64 0:3.0-1.el7.remi php56-php-common.x86_64 0:5.6.40-14.el7.remi php56-php-fpm.x86_64 0:5.6.40-14.el7.remi
Dependency Installed:
php56-php-cli.x86_64 0:5.6.40-14.el7.remi php56-php-pear.noarch 1:1.10.10-2.el7.remi php56-php-pecl-jsonc.x86_64 0:1.3.10-1.el7.remi
php56-php-pecl-zip.x86_64 0:1.15.5-1.el7.remi php56-php-process.x86_64 0:5.6.40-14.el7.remi php56-php-xml.x86_64 0:5.6.40-14.el7.remi
php56-runtime.x86_64 0:3.0-1.el7.remi
Complete!
Next, install the rest of the components of PHP 5.6 via the yum command:
# yum install php56-php-mysql php56-php-pecl-memcache php56-php-pecl-memcached php56-php-gd php56-php-mbstring php56-php-mcrypt php56-php-xml php56-php-pecl-apc php56-php-cli php56-php-pear php56-php-pdo
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.qoxy.com
* centos-sclo-rh: mirror.qoxy.com
* centos-sclo-sclo: mirror.qoxy.com
* epel: my.fedora.ipserverone.com
* extras: mirror.qoxy.com
* remi-php54: mirrors.thzhost.com
* remi-php55: mirrors.thzhost.com
* remi-php56: mirrors.thzhost.com
* remi-php71: mirrors.thzhost.com
* remi-safe: mirrors.thzhost.com
* updates: mirror.qoxy.com
Package php56-php-xml-5.6.40-14.el7.remi.x86_64 already installed and latest version
Package php56-php-cli-5.6.40-14.el7.remi.x86_64 already installed and latest version
Package 1:php56-php-pear-1.10.10-2.el7.remi.noarch already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package php56-php-gd.x86_64 0:5.6.40-14.el7.remi will be installed
---> Package php56-php-mbstring.x86_64 0:5.6.40-14.el7.remi will be installed
---> Package php56-php-mcrypt.x86_64 0:5.6.40-14.el7.remi will be installed
---> Package php56-php-mysqlnd.x86_64 0:5.6.40-14.el7.remi will be installed
---> Package php56-php-pdo.x86_64 0:5.6.40-14.el7.remi will be installed
---> Package php56-php-pecl-apcu.x86_64 0:4.0.11-1.el7.remi will be installed
---> Package php56-php-pecl-memcache.x86_64 0:3.0.8-5.el7.remi will be installed
---> Package php56-php-pecl-memcached.x86_64 0:2.2.0-4.el7.remi will be installed
--> Processing Dependency: php56-php-pecl-igbinary(x86-64) for package: php56-php-pecl-memcached-2.2.0-4.el7.remi.x86_64
--> Processing Dependency: php56-php-pecl-msgpack(x86-64) for package: php56-php-pecl-memcached-2.2.0-4.el7.remi.x86_64
--> Running transaction check
---> Package php56-php-pecl-igbinary.x86_64 0:2.0.8-1.el7.remi will be installed
---> Package php56-php-pecl-msgpack.x86_64 0:0.5.7-1.el7.remi will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================
Installing:
php56-php-gd x86_64 5.6.40-14.el7.remi remi-safe 73 k
php56-php-mbstring x86_64 5.6.40-14.el7.remi remi-safe 525 k
php56-php-mcrypt x86_64 5.6.40-14.el7.remi remi-safe 55 k
php56-php-mysqlnd x86_64 5.6.40-14.el7.remi remi-safe 191 k
php56-php-pdo x86_64 5.6.40-14.el7.remi remi-safe 107 k
php56-php-pecl-apcu x86_64 4.0.11-1.el7.remi remi-safe 63 k
php56-php-pecl-memcache x86_64 3.0.8-5.el7.remi remi-safe 86 k
php56-php-pecl-memcached x86_64 2.2.0-4.el7.remi remi-safe 83 k
Installing for dependencies:
php56-php-pecl-igbinary x86_64 2.0.8-1.el7.remi remi-safe 43 k
php56-php-pecl-msgpack x86_64 0.5.7-1.el7.remi remi-safe 46 k
Transaction Summary
===========================================================================================================================================================
Install 8 Packages (+2 Dependent packages)
Total download size: 1.2 M
Installed size: 3.0 M
Is this ok [y/d/N]: y
Downloading packages:
(1/10): php56-php-gd-5.6.40-14.el7.remi.x86_64.rpm | 73 kB 00:00:00
(2/10): php56-php-pecl-apcu-4.0.11-1.el7.remi.x86_64.rpm | 63 kB 00:00:00
(3/10): php56-php-pecl-igbinary-2.0.8-1.el7.remi.x86_64.rpm | 43 kB 00:00:00
(4/10): php56-php-pecl-memcache-3.0.8-5.el7.remi.x86_64.rpm | 86 kB 00:00:00
(5/10): php56-php-mbstring-5.6.40-14.el7.remi.x86_64.rpm | 525 kB 00:00:00
(6/10): php56-php-pecl-memcached-2.2.0-4.el7.remi.x86_64.rpm | 83 kB 00:00:00
(7/10): php56-php-pecl-msgpack-0.5.7-1.el7.remi.x86_64.rpm | 46 kB 00:00:00
(8/10): php56-php-pdo-5.6.40-14.el7.remi.x86_64.rpm | 107 kB 00:00:00
(9/10): php56-php-mcrypt-5.6.40-14.el7.remi.x86_64.rpm | 55 kB 00:00:01
(10/10): php56-php-mysqlnd-5.6.40-14.el7.remi.x86_64.rpm | 191 kB 00:00:01
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Total 724 kB/s | 1.2 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : php56-php-pdo-5.6.40-14.el7.remi.x86_64 1/10
Installing : php56-php-pecl-igbinary-2.0.8-1.el7.remi.x86_64 2/10
Installing : php56-php-pecl-msgpack-0.5.7-1.el7.remi.x86_64 3/10
Installing : php56-php-pecl-memcached-2.2.0-4.el7.remi.x86_64 4/10
Installing : php56-php-mysqlnd-5.6.40-14.el7.remi.x86_64 5/10
Installing : php56-php-pecl-apcu-4.0.11-1.el7.remi.x86_64 6/10
Installing : php56-php-mcrypt-5.6.40-14.el7.remi.x86_64 7/10
Installing : php56-php-pecl-memcache-3.0.8-5.el7.remi.x86_64 8/10
Installing : php56-php-gd-5.6.40-14.el7.remi.x86_64 9/10
Installing : php56-php-mbstring-5.6.40-14.el7.remi.x86_64 10/10
Verifying : php56-php-mysqlnd-5.6.40-14.el7.remi.x86_64 1/10
Verifying : php56-php-mbstring-5.6.40-14.el7.remi.x86_64 2/10
Verifying : php56-php-gd-5.6.40-14.el7.remi.x86_64 3/10
Verifying : php56-php-pecl-msgpack-0.5.7-1.el7.remi.x86_64 4/10
Verifying : php56-php-pecl-igbinary-2.0.8-1.el7.remi.x86_64 5/10
Verifying : php56-php-pecl-memcache-3.0.8-5.el7.remi.x86_64 6/10
Verifying : php56-php-pecl-memcached-2.2.0-4.el7.remi.x86_64 7/10
Verifying : php56-php-mcrypt-5.6.40-14.el7.remi.x86_64 8/10
Verifying : php56-php-pecl-apcu-4.0.11-1.el7.remi.x86_64 9/10
Verifying : php56-php-pdo-5.6.40-14.el7.remi.x86_64 10/10
Installed:
php56-php-gd.x86_64 0:5.6.40-14.el7.remi php56-php-mbstring.x86_64 0:5.6.40-14.el7.remi php56-php-mcrypt.x86_64 0:5.6.40-14.el7.remi
php56-php-mysqlnd.x86_64 0:5.6.40-14.el7.remi php56-php-pdo.x86_64 0:5.6.40-14.el7.remi php56-php-pecl-apcu.x86_64 0:4.0.11-1.el7.remi
php56-php-pecl-memcache.x86_64 0:3.0.8-5.el7.remi php56-php-pecl-memcached.x86_64 0:2.2.0-4.el7.remi
Dependency Installed:
php56-php-pecl-igbinary.x86_64 0:2.0.8-1.el7.remi php56-php-pecl-msgpack.x86_64 0:0.5.7-1.el7.remi
Complete!
How To Enable PHP-FPM On A CentOS Server
Now that PHP 7.1 and PHP 5.6 are installed on the CentOS Server, it's time to turn them on. Each of the two versions has a php-fpm instance associated with it, and here is the location of their configuration file, www.conf:- PHP 7.1: /etc/php-fpm/www.conf
- PHP 5.6: /opt/remi/php56/root/etc/php-fpm/www.conf
- PHP 7.1: 9071
- PHP 5.6: 9056
Here's the relevant configuration change for PHP 7.1:
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9071
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all IPv4 addresses on a
; specific port;
; '[::]:port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9056
How To Ensure php-fpm Ports Are Not Blocked By SELINUX
SELINUX blocks ports by default, so to allow the new php-fpm ports to function correctly, we need to tell SELINUX to open them up:Here's the semanage command to open up the php-fpm port for PHP 5.6
# semanage port -a -t http_port_t -p tcp 9056
There is no output from this command.
Here's the semanage command to open up the php-fpm port for PHP 7.1
There is no output from this command.
Let's alter the definition for the OLD website, and tell apache that it needs to be processed by the PHP 5.6 related php-fpm instance that is listening to port 9056.
###############################################################################
# GL 2019-11-26 old.holisticpethelp.com
###############################################################################
<VirtualHost *:80>
ServerName old.holisticpethelp.com
DocumentRoot /var/www/vhosts/holisticpethelp.com/old/content
CustomLog /var/www/vhosts/holisticpethelp.com/old/logs/access_log common
ErrorLog /var/www/vhosts/holisticpethelp.com/old/logs/error_log
Alias /webalizer /var/www/vhosts/holisticpethelp.com/old/webalizer
# This setting is necessary for CLEAN URL's in Drupal
<Directory "/var/www/vhosts/holisticpethelp.com/old/content">
AllowOverride All
</Directory>
# Tell the apache server to connect this content to PHP 5.6 via php-fpm
SetHandler "proxy:fcgi://127.0.0.1:9056"
</FilesMatch>
</Directory>
</VirtualHost>
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
# Cannot load both php5 and php7 modules
<IfModule !mod_php5.c>
<IfModule prefork.c>
# GL 2019-11-27 Disabled to enable php-fpm elsewhere
# LoadModule php7_module modules/libphp7.so
</IfModule>
</IfModule>
<IfModule !mod_php5.c>
<IfModule !prefork.c>
LoadModule php7_module modules/libphp7-zts.so
</IfModule>
</IfModule>
Here's what my php.conf file looked like before the modifications for php-fpm:
# grep ^[^#] php.conf
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
Satisfy All
</IfModule>
</Files>
AddType text/html .php
DirectoryIndex index.php
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9071"
</FilesMatch>
NOTE that the entire stanza for IfModule mod_php7c has been removed!
First, start the php-fpm component for PHP 7.1
# systemctl start php-fpm
Next, enable the php-fpm component for PHP 7.1
# systemctl enable php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
OK, time to bump the apache server
# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
Let's see if the the apache server liked being bumped:
[root@vm conf.d]# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2019-11-27 22:53:52 HKT; 4s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 12150 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 12155 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─12155 /usr/sbin/httpd -DFOREGROUND
├─12156 /usr/sbin/httpd -DFOREGROUND
├─12157 /usr/sbin/httpd -DFOREGROUND
├─12158 /usr/sbin/httpd -DFOREGROUND
├─12159 /usr/sbin/httpd -DFOREGROUND
└─12160 /usr/sbin/httpd -DFOREGROUND
Nov 27 22:53:52 vm.yougrow.net systemd[1]: Starting The Apache HTTP Server...
Nov 27 22:53:52 vm.yougrow.net systemd[1]: Started The Apache HTTP Server.
OK - let's see what version of PHP is running on the NEW eCommerce website:
According to my CentOS 7 web server, the version of PHP I am now running is 7.1.33 , and I am using php-fpm to process my PHP, which means everything has worked out so far!
First, start the php-fpm component for PHP 5.6
# systemctl start php56-php-fpm
Next, enable the php-fpm component for PHP 5.6
# systemctl enable php56-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php56-php-fpm.service to /usr/lib/systemd/system/php56-php-fpm.service.
Now bump the apache server
# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
See if the the apache server liked being bumped:
# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2019-11-27 22:53:52 HKT; 4s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 12150 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 12155 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─12155 /usr/sbin/httpd -DFOREGROUND
├─12156 /usr/sbin/httpd -DFOREGROUND
├─12157 /usr/sbin/httpd -DFOREGROUND
├─12158 /usr/sbin/httpd -DFOREGROUND
├─12159 /usr/sbin/httpd -DFOREGROUND
└─12160 /usr/sbin/httpd -DFOREGROUND
Nov 27 22:53:52 vm.yougrow.net systemd[1]: Starting The Apache HTTP Server...
Nov 27 22:53:52 vm.yougrow.net systemd[1]: Started The Apache HTTP Server.
Check to see what version of PHP is running on the OLD eCommerce website:
Great Success!
How To Configure apache To Serve Different PHP Versions
With php-fpm now installed, we can now tell apache which websites need which version of PHP to function correctly. On my system, websites are defined in the vhosts file, located in the /etc/httpd/conf.d directory.
Let's alter the definition for the OLD website, and tell apache that it needs to be processed by the PHP 5.6 related php-fpm instance that is listening to port 9056.
###############################################################################
# GL 2019-11-26 old.holisticpethelp.com
###############################################################################
<VirtualHost *:80>
ServerName old.holisticpethelp.com
DocumentRoot /var/www/vhosts/holisticpethelp.com/old/content
CustomLog /var/www/vhosts/holisticpethelp.com/old/logs/access_log common
ErrorLog /var/www/vhosts/holisticpethelp.com/old/logs/error_log
Alias /webalizer /var/www/vhosts/holisticpethelp.com/old/webalizer
# This setting is necessary for CLEAN URL's in Drupal
<Directory "/var/www/vhosts/holisticpethelp.com/old/content">
AllowOverride All
</Directory>
# Tell the apache server to connect this content to PHP 5.6 via php-fpm
<Directory /var/www/vhosts/holisticpethelp.com/old/content>
<FilesMatch \.php$>SetHandler "proxy:fcgi://127.0.0.1:9056"
</FilesMatch>
</Directory>
How To Turn Off mod_php On A CentOS Server
Turning off mod_php on a Centos Server is pretty easy. You just go to /etc/httpd/conf.modules.d and edit the 15-php.conf file like so:#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
# Cannot load both php5 and php7 modules
<IfModule !mod_php5.c>
<IfModule prefork.c>
# GL 2019-11-27 Disabled to enable php-fpm elsewhere
# LoadModule php7_module modules/libphp7.so
</IfModule>
</IfModule>
<IfModule !mod_php5.c>
<IfModule !prefork.c>
LoadModule php7_module modules/libphp7-zts.so
</IfModule>
</IfModule>
The above changes prevent apache from loading mod_php.
How To Prepare A CentOS Server php.conf For php-fpm Instead Of mod_php
The CentOS Server php.conf file is located in the /etc/httpd/conf.d directory, and preparing it for php-fpm (instead of mod_php) is pretty straightforward.Here's what my php.conf file looked like before the modifications for php-fpm:
# grep ^[^#] php.conf
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
Satisfy All
</IfModule>
</Files>
AddType text/html .php
DirectoryIndex index.php
<IfModule mod_php7.c>
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"
php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache"
#php_value opcache.file_cache "/var/lib/php/opcache"
</IfModule>
Here's what my php.ini file looked like after the modifications for php-fpm:
# grep ^[^#] php.conf
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
Satisfy All
</IfModule>
</Files>
AddType text/html .php
DirectoryIndex index.php
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9071"
</FilesMatch>
NOTE that the entire stanza for IfModule mod_php7c has been removed!
How To Activate php-fpm 7.1 On A CentOS Server
With the CentOS Server now configured to use php-fpm instead of mod_php, it's time to activate the php-fpm module, bump the apache server and see what happens!First, start the php-fpm component for PHP 7.1
# systemctl start php-fpm
Next, enable the php-fpm component for PHP 7.1
# systemctl enable php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
OK, time to bump the apache server
# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
Let's see if the the apache server liked being bumped:
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2019-11-27 22:53:52 HKT; 4s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 12150 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 12155 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─12155 /usr/sbin/httpd -DFOREGROUND
├─12156 /usr/sbin/httpd -DFOREGROUND
├─12157 /usr/sbin/httpd -DFOREGROUND
├─12158 /usr/sbin/httpd -DFOREGROUND
├─12159 /usr/sbin/httpd -DFOREGROUND
└─12160 /usr/sbin/httpd -DFOREGROUND
Nov 27 22:53:52 vm.yougrow.net systemd[1]: Starting The Apache HTTP Server...
Nov 27 22:53:52 vm.yougrow.net systemd[1]: Started The Apache HTTP Server.
According to my CentOS 7 web server, the version of PHP I am now running is 7.1.33 , and I am using php-fpm to process my PHP, which means everything has worked out so far!
How about the User and Administrator websites? Are they OK?
User:
Administrator:
How To Activate php-fpm 5.6 On A CentOS Server
OK - now for the acid test. Can my OLD website function properly now that php-fpm has been installed?First, start the php-fpm component for PHP 5.6
# systemctl start php56-php-fpm
Next, enable the php-fpm component for PHP 5.6
# systemctl enable php56-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php56-php-fpm.service to /usr/lib/systemd/system/php56-php-fpm.service.
Now bump the apache server
# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
See if the the apache server liked being bumped:
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2019-11-27 22:53:52 HKT; 4s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 12150 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
Main PID: 12155 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─12155 /usr/sbin/httpd -DFOREGROUND
├─12156 /usr/sbin/httpd -DFOREGROUND
├─12157 /usr/sbin/httpd -DFOREGROUND
├─12158 /usr/sbin/httpd -DFOREGROUND
├─12159 /usr/sbin/httpd -DFOREGROUND
└─12160 /usr/sbin/httpd -DFOREGROUND
Nov 27 22:53:52 vm.yougrow.net systemd[1]: Starting The Apache HTTP Server...
Nov 27 22:53:52 vm.yougrow.net systemd[1]: Started The Apache HTTP Server.
What about the User and Administrator pages?
User:
Administrator:
REFERENCES:
https://medium.com/@daniel.bui/multiple-php-version-with-apache-on-centos-7-17078c66692chttps://www.svnlabs.com/blogs/install-apache-mysql-php-5-6-on-centos-7/
https://www.cyberciti.biz/faq/centos-rhel-7-redhat-linux-install-gcc-compiler-development-tools/
http://www.servermom.org/how-to-enable-remi-repo-on-centos-7-6-and-5/2790/
https://www.tecmint.com/install-php-5-4-php-5-5-or-php-5-6-on-centos-6/
https://centos.pkgs.org/7/ius-archive-x86_64/php71u-cli-7.1.7-1.ius.centos7.x86_64.rpm.html
https://hostodo.com/portal/index.php?rp=/knowledgebase/12/Install-PHPorPHP-FPM-54-Centos-7.html
https://www.madboa.com/blog/2016/08/29/scl-intro/
https://www.webhostinghero.com/centos-apache-php-fpm/
https://www.drupal.org/docs/8/upgrade/upgrading-from-drupal-6-or-7-to-drupal-8
No comments:
Post a Comment