404 Tech Support

Upgrading the Vultr WordPress application to PHP 7.0

I recently switched my hosting to save costs and gain performance. The unmanaged SSD VPS options are almost too good of a deal to pass up. 404 Tech Support is now running on Vultr and I have been very happy with the performance and price.

To make things easier on me, I used the pre-built WordPress application on Cent OS 6 that Vultr offers. It was super easy to spin up an instance and migrate my site over. One of the benefits of the cloud servers is that they are so easy to spin up additional servers. For less than a penny an hour, I can spin up a separate server and use it to test out plugins, updates, or other changes to the server. In the most recent case, I updated my server to use PHP 7.0. The pre-built application comes with PHP 5.5.30 with Nginx and I really wanted to take advantage of the improved performance with PHP 7.0.

I spun up a test server with Vultr’s simple deploy process, completed the WordPress install by following the server’s instructions, and used FTP to throw a phpinfo.php page up on the server so that I could verify the version change. All in all, it’s about a 5 minute process.

Take a snapshot of your server so you can restore if something goes sideways!

SSH into your server as root or begin these commands with sudo.

Verify which version of PHP your server is running:

php -v

List PHP packages installed through yum:

yum list installed | grep php*

Tell yum to remove the current version of PHP and confirm its questions:

yum remove php55u-*

Add the Webtatic repository:

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Have yum update your packages:

yum update

Install PHP 7 and some equivalent modules that we removed (Note: not all modules are available for PHP 7 yet):

yum install php70w-cli php70w-common php70w-fpm php70w-gd php70w-mbstring php70w-mcrypt php70w-mysqlnd php70w-opcache php70w-pdo php70w-pear php70w-pecl-apcu php70w-pecl-imagick php70w-process php70w-xml php70w-xmlrpc

Verify that your server is now running PHP 7.0.2 (or newer) after the install:

php -v

Edit the PHP configuration so that it runs as the Nginx user and group (Change lines for user and group from ‘apache’ to ‘nginx’):

nano /etc/php-fpm.d/www.conf

Set PHP to start automatically:

chkconfig php-fpm on

Restart Nginx and start PHP manually

service nginx restart && service php-fpm restart

That’s it. You can now confirm with the phpinfo.php page that the server is running the latest version of PHP. If anything went wrong, you can restore to your snapshot. Otherwise, we will assume everything went smoothly and you can enjoy the benefits of PHP 7 on your Vultr server.

If you would like to see the upgrade process as a video, see below: