简体   繁体   中英

Set memory_limit to PHP FPM with .htaccess

I need to modify in the.htaccess the memory_limit, max_input_vars and max_execution_time of php. In order not to modify the global configuration of php on the server.

In my virtualhost, I have this configuration:

<FilesMatch \.php> 
    SetHandler "proxy:unix:/var/run/php/php7.3-fpm.sock|fcgi://localhost/" 
</FilesMatch> 

In my.htaccess I have tested these two configs without success:

<IfModule php7_module>
    php_value memory_limit 512M
    php_value max_input_vars 10000
    php_value max_execution_time 1800
</IfModule>

And

<IfModule mod_php7.c>
    php_value memory_limit 512M
    php_value max_input_vars 10000
    php_value max_execution_time 1800
</IfModule>

In the case of php7.3-fpm.sock , do I have to use it another way?

Thanks

in your configuration file, default path "/etc/php/7.3/fpm/pool.d/php7.3-fpm.conf" or your path, change to:

php_admin_value[memory_limit] = 512M
php_admin_value[max_input_vars] = 10000
php_admin_value[max_execution_time] = 1800

then restart your web service, and test your settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM