PHP 7 + OpCache Now Available on SiteGround Shared Hosting

Sep 12, 2015
3 min read
Archived

SiteGround has recently announced that PHP 7, along with OpCache is now available on all their shared hosting services.

SiteGround is always striving to bring the latest technologies to their hosting products, and a few months ago introduced HHVM to their Cloud Hosting. HHVM is based on the HipHop Virtual Machine, which was pioneered by Facebook to increase PHP performance significantly. PHP 7 is slated to become a direct competitor performance wise to HHVM, and indeed some benchmark tests already suggest PHP 7 is faster.

Also, with the OpCache caching available at SiteGround, along with their SuperCacher technology (NGINX (static + dynamic cache) + Memcache) we believe that once PHP 7 goes mainstream, their performance will be hard to beat. Actually, we lie., with their SuperCacher technology, they already are hard to beat. You can read more about all the other benefits of SiteGround, including their fast support and developer features) here.

How to activate PHP 7 at SiteGround

Activating PHP 7 at SiteGround is very easy. You can activate it either via the cPanel control panel or by adding a line to your .htaccess file.

To activate via the cPanel you can follow the instructions below:

1. Click the PHP Version Manager Icon in cPanel

PHP version manager.

2. Select the directory you wish to activate PHP 7

With SiteGround you can have different directories use different PHP versions. As such you need to select the particular directory, or if you wish the whole account to use the selected PHP version click the public_html link as shown below:

PHP version manager select directory.

3. Choose your PHP Version

On the next screen, you will be able to choose PHP 7.0.0 Beta 3 to enable PHP 7 for your account \ directory.

Select PHP 7.

Once selected, click save and you will get the following confirmation that PHP 7 is now active:

PHP 7 updated.

Alternatively, add this code to your .htaccess file to enable PHP 7

AddHandler application/x-httpd-php70 .php .php5 .php4 .php3

Note that these settings will apply to all subdirectories. If you have subdirectories that you wish to use a different PHP version you can add the relevant code in a new .htaccess file within that directory.

Enabling OpCache

The PHP 7 OpCache functionality is enabled by default. The files for the OpCache are stored in the following directory:

/home/user/.opcache

At present, clearing the OpCache is not integrated within their SuperCacher plugin. This means that to clear the cache, you must delete the whole opcache directory manually.

PHP 7 is in Beta - That means issues are expected

SiteGround is very clear to warn that PHP 7 is still in Beta. This means you should not use it on a live (production) website, and that there may be some compatibility issues with your website in the short term.

While SiteGround state that they have tested PHP with default versions of WordPress, Joomla and Drupal it is possible that various themes \ plugins will not be compatible due to several PHP functions being depreciated within PHP 7.

Also, Memcache is not yet compatible with PHP 7, so if you are using SiteGround’s SuperCacher, then you will need to disable the Memcache option. Hristo Pandjarov stated that they are working on a patch for this:

Yes, if you delete the droplet and there aren’t any other problems, it should work. But don’t delete the entire SG CachePress plugin, just disable the Memcache option. We’re working on a patch for that at the moment so we will make it available with PHP 7 shortly.

Grab 60 percent Off SiteGround hosting and try it out

If you want to test out PHP 7, you can currently get up to 60% off with ourĀ SiteGround coupons.

Also, you can read up on some benchmark tests between PHP 5.6, HHVM and PHP 7 here.