Difference between revisions of "How to change PHP settings with a php.ini"

From Acenet Knowledgebase
Jump to: navigation, search
(No difference)

Revision as of 09:43, 4 January 2013

This article shows you how to customize the php configuration using a php.ini file to modify php configurations for your script. You can change any of the PHP settings that are configured on the server by using a custom php.ini file. All you need to do is create a text document entitled:

php.ini

Within this text document, specify the setting(s) you're wanting to change on separate lines. Here are some examples of PHP settings that you can change:

register_globals = Off
memory_limit = 64M

You will then need to set the permissions of the file to '755' and place it within the executing script's directory (the same directory that your script is located that requires this setting) because php.ini files are not recursive. If you're wanting to make your custom php.ini file recursive, in which it will affect all of your account's web accessible directories, you can view details on how to do so here:

How to make a php.ini file apply to all subdirectories

You will want to be careful when using a recursive php.ini file though because it will affect all of the scripts installed within your account. A recursive php.ini file may even cause some of your scripts to break if they need settings configured differently than what you have specified in your recursive php.ini file.

You can verify that the settings you specified have taken effect by creating a text document entitled:

phpinfo.php

with the following specified within it:

<? phpinfo(); ?>

You will then upload the 'phpinfo.php' file to the same directory you uploaded the 'php.ini' file to and view the 'phpinfo.php' file in your internet browser.