Let’s find out how you can Modify Default PHP Values in a suPHP environment.

You might encounter situations where you would want to temporarily modify the value of any default PHP setting, for your CMS or for other php files to work. Typical scenarios are where you encounter PHP memory errors, where you want to increase the size of the file you want your PHP script to upload etc.

This can be easily accomplished by creating a custom php.ini file  with the settings you wish to configure within your public_html directory. This file is identical in syntax to the server’s main php.ini file and houses all the customizations you want for your site. The downside is that this file is not inherited as the php values in .htaccess were, it only effects the directory it is located in.

The steps you need to follow:-

1. Create a php.ini file
2. Have your new setting specified in this file in the format: setting_name = setting_value.

Example –

register_globals = Off
memory_limit = 128M
upload_max_filesize = 4M

You can verify if PHP is being loaded with your new setting by creating a PHP Info page. Steps to do that is mentioned here. Know how to have your PHP values inherited to all sub-directories.

Leave a Reply

Your email address will not be published.