How to amend common PHP options / settings (via the .user.ini or PHP Selector)

269ac00f765508cb74b25d006dbf5bb2

Written by Dennis Nind

Last published at: March 3rd, 2019

Here at Brixly, we have quite a unique configuration in terms of the way PHP is handled. By default, we use 'nginx' which reverse proxies to Apache, then the PHP itself is handled by a handler called 'mod_lsapi'. When using either the Bolt-Cache, or CloudNS plugin the method will vary, as PHP is then handled by 'PHP-FPM'.

Common variables you may want to update are...

allow_url_fopen
date.timezone    
display_errors
error_reporting
log_errors
max_execution_time
max_input_time
max_input_vars
memory_limit
open_basedir
post_max_size
session.save_path    
short_open_tag
upload_max_filesize


How to update your PHP settings...

Proxy / Default (Apache) *Applies if you are not using the Bolt-Cache / CloudNS plugins

If you are using the default 'proxy' method of serving your content, then your site / domain is being served via 'Apache' using the mod_lsapi PHP Handler.

As such, the PHP Settings are configured through the 'PHP Selector' in cPanel...

cPanel -> Software -> Select PHP Version

When you first access this screen, you will be presented with the ability to update the version of PHP being used, not the 'PHP Options'. To set custom variables / settings for PHP, you simply select the 'Switch to PHP Options' button in the top-right hand corner...

From here, you will now be able to ammend the PHP Settings...

Once you click 'Save' the changes will be made immediately.

Bolt-Cache / CloudNS (PHP-FPM / NGINX)

If you are using the Bolt-Cache, or CloudNS plugins to set 'nginx' mode, then PHP settings are set through a .user.ini file.

The PHP .user.ini file allows you to customize PHP directives.

Perform the following steps to set up a user.ini file:

1) Log in to cPanel.

2) Navigate to the File Manager (Home >> Files >> File Manager) interface.

php-user-ini

 

3) Make sure that you are in public_html directory and hidden file visible.

 

4) Click the option ‘File’ to create the new File.

php-user-ini

 

5) In the Create a New Field text box, enter .user.ini and click Create New File.

6) If you want to edit the.user.ini file click the file and edit.



How do I verify the changes have been saved?

You can verify the PHP settings have been applied correctly, by adding a 'phpinfo()' file to your site.

To do this, you can create a file (any filename, such as 'info.php') and add the following snippet of PHP...

<?php phpinfo(); ?>