Using ini_set to control PHP’s configuration

Using ini_set to control PHP’s configuration


Unlike cPanel hosting, our clustered cloud environments do not allow the use of php.ini for modifications of default PHP configuration. In order to modify the global PHP options in Cloud hosting, you need to use the ini_set(); PHP function inside the code of your scripts as required.

If the directive that you wish to change is not available for modification using ini_set, then you might want to consider upgrading to a cPanel based plan, where php.ini may be used and more freedom is allowed. However the developers of php have attempted to ensure that most operational changes can be made using the ini_set(); function.

Using ini_set(); command in scripts

It’s the same as using any other PHP command, you merely add the command to a script which requires whatever new option you wish to set. e.g. if you need to increase upload size limit to upload a file to a folder – update the uploading script to include the PHP option directive. See Examples below for what it should appear as.

For full syntax of all types of ini_set command directives, please visit the php manual:

Please note that not all the available PHP options can be changed using ini_set(). A list of all available options can be found at:

Examples of ini_set(); directives in PHP scripts

Increasing Memory limit using ini_set command to 128MB:


Increasing default size limitation for file Uploads to 50MB per file:


Full list of available ini_set directives is located at

Making the update global for your hosting account

You might want all your subdirectories and scripts to use the same updated configuration. To achieve this, simply place the ini_set code into file that is globally included for your website application.

Most web applications use include files for standard configuration options for the application. Update any include file which is loaded in all your scripts – and the configuration update will be in effect across the entire application.

For example, adding these commands to your wordpress installation’s  wp-config.php file, will make the changes take affect across your whole wordpress site.

  • 98 Users Found This Useful
Was this answer helpful?