WordPress 5.2, PHP, and CentOS 7
CentOS 7, because parent Red Hat policy does not update PHP versions, is locked at version 5.4.
Reading around the web finds the usual copypasta with almost nobody understanding what they are explaining. Many people recommend using a site called
webtatic.com, maintained by somebody named Andy Thompson. Trustworthy? I haven’t a clue.
The next popular copypasta is for the “remi” site, maintained by Red Hat employee Remi Collet. The repository is primarily focused on PHP packages. I would say this repository is trustworthy.
Noteworthy though, is the SCL repository is the only third-party repo sanctioned by upstream Red Hat.
Using SCL is straightforward. Configuring the additional PHP packages is not. After much effort digging around the web looking for clues, I finally got everything working.
yum install centos-release-scl yum install rh-php72 rh-php72-php rh-php72-php-fpm rh-php72-php-mysqlnd
# SetHandler application/x-httpd-php # This is the default with php 5.4: #<FilesMatch \.php$> # SetHandler application/x-httpd-php #</FilesMatch> # This is the default for php7: <FilesMatch \.php$> SetHandler "proxy:fcgi://127.0.0.1:9000" </FilesMatch>>
Now enable and put everything in motion.
systemctl enable rh-php72-php-fpm.service systemctl start rh-php72-php-fpm.service scl enable rh-php72 bash systemctl restart httpd
Verify port 9000 is open.
The SCL package does not include a way to use the new PHP path on login. Add the following
#!/bin/bash source scl_source enable rh-php72
After logging in
php -v should show the newer version.
Complex. Typical of Red Hat engineering. Why not make SCL like Debian Backports and just allow users to update the existing PHP packages and be done?
WP should be working with the new PHP. Update to WP 5.2.
Then find a better way to run a blog or web site and find a less complex distro.