Version 2.4 is our latest release.

PHP execution limits

There are several PHP configuration settings that may be responsible for prematurely halting a script. This is a frequent problem in many installations, especially when handling large file uploads. In the PHP site there is also a useful guide we recommend reading: Common pitfalls.

Some of these values are set during installation, in the PHP configuration pool you set up here:

The php.ini file

Additionally, some of these execution limit settings are maintained in the php.ini file found on your server/computer. One thing to double-check is that you are updating the correct php.ini file (it is possible there is more than one - one for your browser settings, and one for the command-line, for example), and the location of these files is not consistent, as it depends on a number of other factors.

Here are a couple of links to help you locate the file(s) on your system - you might want to double-check to see if there are other files as well:

Locating your web config file

The easiest way to locate your php.ini web config file is to create a simple PHP file with a single line of code in it, and view the output.

  1. Using a text editor, create a new file (name it however you want, e.g. test.php), and make sure it ends with .php extension.
  2. Put this single line of code in the file:
<?php phpinfo(); ?>
  1. Save the file, and then place it on your AtoM server, in the root AtoM directory - if you have followed our recommended installation instructions, this is generally /usr/share/nginx/atom.
  2. Open the file via your web browser. For example, if you placed it into your root folder, run http://mywebsite.com/test.php.
  3. In the page displayed, find the “Loaded Configuration File” row for your php.ini file location.

Important

Make sure to delete the phpinfo script above when it’s not needed, as the information displayed could be used by malicious persons to compromise your website security.

Locating your command-line config file

Run the following command via the command-line interface:

php -i | grep php.ini

The command-line will return the location of your PHP configuration file.

Adjusting PHP script execution limits

max_execution_time:

This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 30.

max_execution_limit = 30

More info: http://ca2.php.net/manual/info.configuration.php#ini.max-execution-time

memory_limit:

Limits the amount of memory a script may consume (in bytes [B], kilobytes [K], megabytes [M] or gigabytes [G]).

memory_limit = 128M

Please note that this memory limit is not related to the amount of system memory (RAM) available, but is an artificial limit imposed by PHP to avoid run-away scripts from consuming all system resources. This implies that adjusting the PHP configuration should be done before deciding whether adding more RAM to your system may be beneficial. This limit is especially important if you are trying to process digital objects because it is needed to allocate enough memory to process both the input and the output digital object. See the following table:

Size (MB) Megapixels
100 13
128 18
256 35
512 70

More info: http://ca2.php.net/manual/ini.core.php#ini.memory-limit

post_max_size:

Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size. When an integer is used without specifying the unit, the value is measured in bytes - shorthand (in bytes [B], kilobytes [K], megabytes [M] or gigabytes [G]) may also be used to specify bigger values.

post_max_size = 72M

More info: https://secure.php.net/manual/ini.core.php#ini.post-max-size

upload_max_filesize:

The maximum size of an uploaded file. When an integer is used without specifying the unit, the value is measured in bytes - shorthand (in bytes [B], kilobytes [K], megabytes [M] or gigabytes [G]) may also be used to specify bigger values.

upload_max_filesize = 64M

More info: https://secure.php.net/manual/ini.core.php#ini.upload-max-filesize

After making configuration changes

If you do make changes to the PHP configuration poool and/or the php.ini default settings, you should restart PHP-FPM after, and clear your application caches.

In Ubuntu 14.04 with PHP 5.x:

sudo service php5-fpm restart
sudo service memcached restart
php symfony cc

In Ubuntu 16.04 with PHP 7:

sudo systemctl restart php7.0-fpm
sudo systemctl restart memcached
php symfony cc

Tip

Learn more about AtoM command-line tasks and basic maintenance commands in the following slide deck:

New to using the unix command-line? If so, this slide deck will help you get started:

Back to top