change PHP configuration settings through php.ini file

PHP configuration settings through php.ini.

In this article we will discuss about changing  PHP configuration settings through php.ini file.

Finding the correct php.ini file :

Locate the php.ini file that is been used by the server. By Using phpinfo() PHP function we can locate the exact php.ini file used. Path of the php.ini file can be found by checking the value assigned to  “Loaded Configuration File” when we run the code that displays output of phpinfo() .

In php.ini file you can change the required settings like below.

Enabling Extensions :

Extensions can be enabled or disabled through php.ini file by added or removing “;” in front of the required extension.

Example : enabling mysql extension

;extension=php_mysql.dll  ( Disabled)

extension=php_mysql.dll ( Enabled )

In this way we can Enable or Disable the Extension as per the requirements.

Changing Settings :

php.ini file also provide the option to change the default setting .

Examples :

max_execution_time = 300; // 5mins
memory_limit = 128M; Maximum amount of memory a script may consume (32MB)
upload_max_filesize = 12M;
short_open_tag = Off
safe_mode = Off
error_reporting = E_ALL & ~E_NOTICE
register_globals = Off
magic_quotes_gpc = On
file_uploads = on

Leave a Reply

Your email address will not be published. Required fields are marked *