How to Change PHP Settings

Sometimes while we programming with PHP we require to change some php.ini settings.
so how to change php settings, There are several ways.

  • Using php.ini
  • Using .htaccess file
  • Using ini_set() function

How to Change PHP Settings
Using php.ini
In this method we should have direct access of php.ini file, in which you can make change in settigs and restart the server Apache http://www.apache.org/ or IIS http://www.iis.net/, after restarting server, settings will be saved.

  • Using .htaccess file

Using .htaccess is the simple way in most of the LAMP and WAMP servers.
Here is the code example how to do the same,
For e.g. if we want to change settings for maximum upload size, we need to change upload_max_filesize parameter.
Code:

php_value upload_max_filesize 8M

Above code will change parameter with the value 8M

Using ini_set() function
This method is use PHP code to do the same, here is the example code

ini_set("upload_max_filesize","8M");

You might like:

Leave a Reply