Monday, February 7, 2011

How do I create a custom php.ini file?

runs PHP through CGI which means in order to override the default settings of PHP you must use a custom php.ini file.  A custom php.ini file can be constructed and placed in your web account. For instance, using a text editor such as Notepad, you can create a php.ini file with the following custom setting which would override our default server setting.
The php.ini file should only contain the custom settings that you wish to alter, as well as our base php.ini data as listed below. When you create a custom php.ini file it is used instead of the default one on our server. This means you will also need to redefine some settings in your php.ini to ensure maximum compatibility with our servers. The base settings that must be redefined are determined by the version of PHP you are running.

PHP4

view sourceprint?
1register_globals = on
2upload_tmp_dir = "/tmp/"
3upload_max_filesize = 20000000
4post_max_size = 20000000
5zend_extension = /usr/local/nf/share/ioncube/ioncube_loader_fre_4.4.so

PHP5

view sourceprint?
1register_globals = on
2upload_tmp_dir = "/tmp/"
3upload_max_filesize = 20000000
4post_max_size = 20000000
5zend_extension = /usr/local/nf/share/ioncube/ioncube_loader_fre_5.2.so
 
With the above lines added to your custom php.ini file you are now free to add your own settings or overwrite the defaults. For a complete list of settings that you may configure in the php.ini file, please refer to the PHP manual.
When changing the maximum file upload size, please ensure you have changed both the upload_max_filesize and post_max_size configuration together. The two settings should have the same value.
 Source Netfirms.com