Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Applications

Updating PHP 5.6w to 7.1u on CentOS 6.10

Submitted by on December 30, 2019 – 9:53 pm

This is mostly just a note to self. As I mentioned previously (probably more than once), I very much dislike systemd and will stick with CentOS 6 for as long as possible. Having said that, WordPress dashboard has been nagging me about having to update PHP. So here we go.

I had PHP 5.6w from webtatic repo and now I need to install version 7.1u from the iuscommunity.org repo. The first step, as I’ve learned, should’ve been updating all the WordPress plugins, especially if you haven’t done that in a while. This is what I did for PHP version update:

# as root
cd
/bin/cp -p /etc/php.ini /etc/php.ini_56w
/bin/cp -p /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf_56w
yum list installed | grep -i webtatic > installed_php_webtatic.txt
yum -y remove webtatic-release
yum -y install https://centos6.iuscommunity.org/ius-release.rpm
yum -y remove php56w*
yum -y install $(grep ^php installed_php_webtatic.txt | awk -F. '{print $1}' | sed 's/php56w/php71u/g' | xargs)
yum -y install php71u-mysql* php71u-json php71u-fpm pear1u
/bin/cp -pf /etc/php.ini_56w /etc/php.ini 
/bin/cp -pf /etc/php-fpm.d/www.conf_56w /etc/php-fpm.d/www.conf
chkconfig php-fpm on
service php-fpm restart
php -v
service httpd restart

And that did it. It also broke one my older WordPress sites: the mysql_get_server_info function has been removed from PHP 7 for security reasons. You can find the plugins that may use this function like so:

# cd ${your_website_home}/wp-content/plugins] 130 # ack "mysql_get_server_info\(\)"

wp-table-reloaded/views/view-about.php
101:            <br/>&middot; mySQL (Server): <?php echo mysql_get_server_info(); ?>

wptouch-pro/admin/html/settings/sysinfo.php
9:                      <td><?php echo $_SERVER['SERVER_SOFTWARE']; ?>, <?php echo $_SERVER['GATEWAY_INTERFACE']; ?>, PHP <?php echo phpversion(); ?>, <?php $link = mysql_connect( DB_HOST, DB_USER, DB_PASSWORD ); if ( !$link ) { die( 'Could not connect: ' . mysql_error() ); } printf( "MySQL %s", mysql_get_server_info() ) ;?></td>

tablepress/views/view-about.php
186:                    <br />&middot; mySQL (Server): <?php echo $mysqli ? mysqli_get_server_info( $GLOBALS['wpdb']->dbh ) : mysql_get_server_info(); ?>

advanced-category-excluder/advanced-category-excluder.php
128:            $sql_version = substr(mysql_get_server_info(),0,3);

Go through the list, rename the plugin folder, see if that restored access to the site. If not, rename it back and continue until you find the culprit.

Print Friendly, PDF & Email

Leave a Reply