Search  
   
Browse by Category
 
Netfirms 24/7 Support .: SCRIPTS & APPLICATIONS .: PHP .: How do I create a custom php.ini file?

How do I create 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. For instance:

file_uploads=off

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

register_globals = on
session.save_path = "/mnt/w9999/.phpsessions"
upload_tmp_dir = "/tmp/"
upload_max_filesize = 20000000
post_max_size = 20000000
zend_extension = /usr/local/nf/share/ioncube/ioncube_loader_fre_4.4.so

PHP5

session.save_path = "/mnt/w9999/.phpsessions"
register_globals = on
upload_tmp_dir = "/tmp/"
upload_max_filesize = 20000000
post_max_size = 20000000
zend_extension = /usr/local/nf/share/ioncube/ioncube_loader_fre_5.2.so
extension_dir = /usr/local/nf/php5/lib/php/extensions
extension=pdo_mysql.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 page found at http://www.php.net/manual/en/ini.php. Please be informed that the php.ini file does not require all of these settings; only enter the line that you wish to change from the default value.

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 share the same value.

NOTE: The php.ini file will only affect PHP files located in the same directory as it. It will not affect any PHP files in a subdirectory or in another directory level. This means if you need the settings or configurations to take place in multiple areas of your web site that are stored within different folders, you must create and place a php.ini file in every folder.

The following settings cannot be manipulated via a custom php.ini as they are dictated by the hosting plan that you subscribe to

memory_limit
max_execution_time
max_input_time

To see your default php.ini settings, load the following lines of code into a server_info.php file and run the file in your browser:

<?php phpinfo(); ?>

How helpful was this article to you?


.: Powered by Lore 1.5.6
Visit Netfirms.com Web Hosting | Copyright © 1998 - 2009 Netfirms, Inc. All Rights Reserved.