Magento 2.0.18 is the final 2.0.x release. After March 2018, Magento 2.0.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Set ulimit for the web server user

Why to set ulimit

Rolling back to a previous backup can silently fail, resulting in incomplete data being written to the file system or database. (This includes all types of rollbacks, including using System Upgrade, Component Manager, or the magento setup:rollback command.)

In some cases, a very long query string causes the user’s allocated memory space to run out of memory because of too many recursive calls.

How to set ulimit

We recommend setting the ulimit for the Magento file system user to a value of 65536 or more.

You can do this either on the command line or you can make it a permanent setting for the user by editing their shell script.

Before you continue, if you haven’t done so already, switch to the Magento file system owner.

Command:

ulimit -s 65536

You can change this to a larger value if needed.

The syntax for ulimit depends on the UNIX shell you use. The preceding setting should work with CentOS and Ubuntu with the Bash shell. However, for Mac OS, the correct setting is ulimit -S 65532. Consult a man page or operating system reference for more information.

To optionally set the value in the user’s Bash shell:

  1. If you haven’t done so already, switch to the Magento file system owner.
  2. Open /home/<username>/.bashrc in a text editor.
  3. Add the following line:

    ulimit -s 65536
    
  4. Save your changes to .bashrc and exit the text editor.

We recommend you avoid setting a value for pcre.recursion_limit in php.ini because it can result in incomplete rollbacks with no failure notice.

Updated