To override php settings, make use of the .user.ini mechanism for php-fpm.
Put that .user.ini file with your PHP application to configure PHP settings such changing the max execution time, increasing memory limits, and many other configurations.
This file is best created inside the root folder of your website (e.g. public_html):
cat .user.ini memory_limit=3072M
cat .user.ini max_execution_time=300 post_max_size=600M upload_max_filesize=512M
- The changes to a .user.ini are only re-read every 5 minutes by default! Have some patience or possibly you can speed up the process by restarting php-fpm (on control panel).
- Feel free to override (almost) any other setting!
- Make sure to test the appliction of the override via a phpinfo() script ;)
- This only applies to the web requests, for the CLI you can simply override the settings on the commandline , e.g. php -d memory_limit = 3072M yourscript.php
- EXCEPTION: For example Magento2 with nginx has an override inside the 50main.conf which enforces certain defaults
fastcgi_param PHP_VALUE "memory_limit=2048M \n max_execution_time=18000";