Php Limit DirectAdmin

We can increase php limit, and set it up permanently, so that system update cannot reset the limit.

Locate the Php version path in the system;


/usr/local/phpXX

Suppose, you got the path is /usr/local/php74

So, your php.ini file path will be /usr/local/php74/lib/php.ini

But you should not edit the  /usr/local/php74/lib/php.ini file directly, because it will be replaced by any future update !

Edit a custom file so that it not get overwritten with update,

/usr/local/php74/lib/php.conf.d/90-custom.ini


Set Php limit;


nano /usr/local/php74/lib/php.conf.d/90-custom.ini

Add the following limits to the file

max_execution_time = 300
max_input_time = -1
max_input_vars = 30000
memory_limit = 768M
post_max_size = 512M
upload_max_filesize = 384M


If you have multi php version, then set up the custom php.ini for all version.


Additionally, Set modifiable limit ranges that user can customize;

cp /usr/local/directadmin/data/templates/php_settings.json /usr/local/directadmin/data/templates/custom/php_settings.json

nano /usr/local/directadmin/data/templates/custom/php_settings.json








########################################

CloudLinux Php Selector;


If you use the CloudLinux, then the php.ini path is different !

Set the Global php limit for alt-php;

nano /etc/cl.selector/global_php.ini

Add the following settings to the bottom of the file;

max_execution_time = 300
max_input_time = -1
max_input_vars = 30000
memory_limit = 768M
post_max_size = 512M
upload_max_filesize = 384M


Additionally, Set modifiable limit ranges that user can customize;

nano /etc/cl.selector/php.conf

Then re-build the PHP-Selector with reinstall command;

yum reinstall lvemanager cagefs alt-python27-cllib

cagefsctl -r



Then reboot the server

Post a Comment