Search the articles in our knowledge base!

How to change the value of a PHP setting?

There are two ways to change the value of a PHP setting: through the SiteGround' PHP Variables Manager or by manually creating a local php.ini file and uploading it in the chosen folders.

   1. Change the value of a PHP setting through the SiteGround' PHP Variables Manager:

You can apply changes to the PHP values using our tool in cPanel. The tool can be found under:

cPanel -> PHP Variables Manager

Once you go to the specified section you can write the variable which you wish to change and press the Add button. The variable will appear below and you can choose to enable (green tick) or disable it (red cross).

After you make the necessary changes press the Save button and the changes will be saved.

The Apply changes to all sub-directories? check will allow you to add the changes to the current folder and all associated subfolders if you need such functionality to be applied.

   2. Change the value of a PHP setting through a local php.ini file:

Alternatively, you can manually apply custom PHP settings on a per-folder basis using a local php.ini file.

For example, you need register_globals set to Off in a directory. For this purpose you should log in your cPanel and go to the File Manager. There navigate to the directory where you'd like this setting applied. In this directory create a file php.ini containing:

register_globals = off

Naturally, if you'd like register_globals turned on you should specify:

register_globals = on

The above works perfectly fine with most web hosting companies, including Siteground.

However, there are two exceptions:

- some important PHP limits cannot be changed, for example memory_limit and max_execution_timeout. Setting different values than the administratively assigned will endanger the overall shared server performance.

- PHP might be compiled as an Apache module. In this case try using a .htaccess file containing:

php_value name value

For example, if you'd like to turn off register_globals you have to specify:

php_value register_globals off

Please note that you cannot change global PHP settings with a local php.ini file if you are using PHP 5.1. Also there are certain limits that are globally defined and cannot be changed per account. 

If you want to be able to use different PHP settings and PHP versions on a per-folder basis, you can sign up for a hosting account at SiteGround. We offer the best PHP hosting and our support team is ready to assist you with any PHP questions/problems you may have.

VN:F [1.9.22_1171]
Rating: 2.7/5 (16 votes cast)
How to change the value of a PHP setting?, Rating 2.7 out of 5 based on 16 votes