wiki:faq/server/change-php-ini-settings

Version 20 (modified by JaimeV, 7 months ago) (diff)

--

How do I increase my PHP file upload limit or change my php.ini settings?

When accessing via the web

You have full control over your PHP installation - you can change any php.ini setting that you would like. By default, your sites will use our global php.ini file (which is located in /etc/php/7.0/fpm/php.ini or another folder depending on the version of php you have selected in your web configuration).

If you would like to override any of those settings, you'll need to edit your site's custom php.ini file.

Finding your custom php.ini file

For members on shared hosting, a .user.ini file is created automatically in your web folder. This file is symlinked a custom php.ini file fo this site. For site example.org from the example membership the path would be:

/home/members/example/sites/example.org/include/php5/php.ini

All versions of php-fpm will read the .user.ini file in the your web document root so don't worry about the reference to php5 file in the path above. For members not using shared hosting, see below - you will need an admin to help you.

what you can change in php.ini

For example, if you want to increase the upload file limit size, you may want to add:

upload_max_filesize = 12M
post_max_size = 12M
max_execution_time = 300

Note: when increasing your upload_max_filesize, you should also:

  • increase your post_max_size (the maximum amount of the total size of posted data) and the max_execution_time (amount of time your script is allowed to execute - it might take a while to upload a large file)
  • And, if you are increasing the max file size above 8 MB, you will also need to change your fcgid settings in the control panel.

Optionally, you may also want to increase the amount of memory your php scripts can use with:

memory_limit = 64M

Another option is to turn off APC (only do this if you are experiencing segfaults in your error logs:

apc.enabled=0

Once you have created this file you may need to reload your web settings to force the change to take affect. You can do that by logging into the Members control panel, choosing Web Configuration, click edit next to your web configuration, and then submit (without making changes).

IMPORTANT: Please use caution when changing these settings. Take note of the default setting and only change minimally as needed. We are operating on shared servers - so if you change your site to use more resources, you may have an adverse impact on the other members.

If you are using a VPS

Then you must open a support ticket and ask an admin to create a /etc/php5/conf.d/yoursite.ini file with these changes. For admins: please chown this file to the user so they can make changes without admin intervention.

When accessing via drush

If you are using drush, your custom php.ini file will not be used. To change settings, create a file called drushrc.php and place this file in your Drupal site's sites/default/ directory or your ~/.drush directory. You can add settings like:

<?php
ini_set('memory_limit','128M');

To eliminate the auto update warning add this as well:

$options['self-update'] = FALSE;