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

From Acenet Knowledgebase
Jump to: navigation, search
(test)
 
Line 1: Line 1:
<html> This article shows you how to customize the php configuration using a php.ini file to modify php configurations for your script.  
+
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:  
 
  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<br /><br />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:  
+
 
<div class="code_style">register_globals = Off<br />memory_limit = 64M</div>
+
<pre>php.ini</pre>
<br />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:
+
 
<a title="How can I create a recursive php.ini file?" href="https://esupport.acenet-inc.net/index.php?/Knowledgebase/Article/View/197/0/how-can-i-create-a-recursive-phpini-file">How can I create a recursive php.ini file?</a>
+
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:  
  <em>Note - 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.</em>
+
 
<strong>--Additional Information--</strong>
+
<syntaxhighlight lang="bash">register_globals = Off
You can verify that the settings you specified have taken effect by creating a text document entitled:  
+
memory_limit = 64M</syntaxhighlight>
phpinfo.php  
+
 
with the following specified within it:  
+
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:
<div class="code_style"><? phpinfo(); ?></div>
+
 
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. </html> [[Category:PHP]]
+
[[How can I create a recursive php.ini file?]]
 +
   
 +
{{note|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:  
 +
 
 +
<pre>phpinfo.php</pre>
 +
 
 +
with the following specified within it:  
 +
 
 +
<syntaxhighlight lang="bash"><? phpinfo(); ?></syntaxhighlight>
 +
 
 +
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.
 +
 
 +
[[Category:PHP]]

Revision as of 16:28, 5 October 2012

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 can I create a recursive php.ini file?

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.