There was a problem loading the comments.

Custom php.ini file - how to create, modify, delete

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
  • 10 January 2007 1:38 PM

If you use php scripts, then the odds are you may need to consider using a custom php.ini file at some point.

Normally, everyone should ensure at least two php settings:

register_globals = Off
session.use_trans_sid = 0

But some older or not well written scripts may not run with these settings settings, so you should do some testing before making production changes to these values.

You can check your current settings using the phpinfo() function. Make a .php file that has this one line:

The execute it. That will tell you the default settings on your server, and it will tell you the location of the default php.ini file.

You may also want to make other changes to allow larger file uploads through php scripts, to set your own sessions directory for better security, to set a temp upload directory, or to change any number of other settings.


If you want to use a custom php.ini file, there are two things to remember:

1) You must put the custom php.ini file in every directory that has php scripts that need the change or add the following command to your .htaccess

suPHP_ConfigPath /home/user/public_html/php.ini

"make sure your custom php.ini is in /home/user/public_html/php.ini "
"make sure you replace \'user\' with your account username"


2) Make the changes to the IndicHosts.net already customized version of the php.ini file (the default php.ini file). Do not make a custom php.ini file with only the values you want to change or you will lose all the default modifications.



To make this easier, there are three scripts you could use.

The first can be used to "read the Server's php.ini file, make your changes, and write your custom php.ini to your main directory". That script can be found here: Script to create a custom php.ini file

If you use php4, the second script "takes your custom php.ini file from your main directory and copies it to all the other directories". That script can be found here: Script to populate directories with your php.ini file

The third script will "delete all your php.ini files" in the event you just want to start over. That script can be found here: Script to delete all custom php.ini files

Indichosts.net does not make frequent changes to the standard php.ini file, but you still may want to repeat the process once in a while. You could set the scripts to run via cron every night, then you would know you always have the latest revisions.


Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  


Self-Hosted Help Desk Software by SupportPal
© Indichosts.net