The process of setting your PHP version and the 'variables' (such as memory_limit values) differs, depending on whether you have Bolt-Cache / CloudNS enabled.
The reason for this is that the Bolt-Cache and CloudNS essentially change the way in which your sites are served, from Apache to NGINX with PHP-FPM to improve performance.
It's this unique stack that allows us to offer industry-leading caching and performance options that typically wouldn't be possible on other hosting platforms.
As such, we have broken this down into those two applicable options so you can be sure you are setting the PHP settings / variables correctly.
1.) My site is not using Bolt-Cache or CloudNS (default)
2.) My site is using CloudNS or Bolt-Cache for Improved Performance
If you are unsure of how to check whether your site is using Bolt-Cache or not, click here to find out.
Scenario 1.) I have Bolt-Cache or CloudNS Disabled
If Bolt-Cache or CloudNS is disabled on your account, your site is using Apache to serve the contents. As such, you are able to make full use of our PHP Selector which is part of the Cloudlinux OS used here.
How to use the ‘Select PHP Version’ option in cPanel
Here is a quick video tutorial on how to change your PHP version using cPanel…
Users can find PHP Selector functionality under the “Select PHP version” in their cPanel home page.
The process of setting the PHP version can be found in the video above.
On the top right of the PHP Selector, there is a link to 'PHP options' where end-users can adjust the most important values. For example, memory_limit or upload_max_filesize.
End users do not need to modify any files like “php.ini”, ".user.ini" or “htaccess” manually – everything is done from the web interface.
Scenario 2.) I have Bolt-Cache or CloudNS Enabled
First of all, awesome choice! Now that you are using our supercharged NGINX stack to its full advantage, its time to learn how to set your PHP version and PHP variables!
As we are no longer using Apache, its important first of all to clarify that the PHP Selector explained above will no longer be applicable.
How do I set the PHP version when using Bolt-Cache?
Easy! It's set when you enable Bolt-Cache in the first place! The Bolt-Cache interface explicitly asks you to select the version during its setup, which will be the version in use on the site.
Please note, that the PHP Selector is no longer in use at this stage.
How do I set PHP variables / options, such as memory_limit etc?
If your site is using Bolt-Cache or CloudNS, we have switched your sites backend to raw NGINX with PHP-FPM so you can benefit from its outstanding performance! Clever, huh?!
So, at this stage we know that the PHP selector is ignored - so where do we set the variables and options for our sites?
All you need to do is create a .user.ini file in your public_html...
/home/yourusername/public_html/.user.ini (notice the '.' - its required!)
You now use this file exactly the same as you would with a php.ini file (if that makes no sense to you, not to worry!) - basically, you can use this file now to set your PHP options / settings as required for your site.
For example, lets set our memory_limit for the site to 512M. To do this, just add the following line to the file...
That's it! Save the file, and the changes will be applied instantly!