简体   繁体   English

使用 .htaccess 将 memory_limit 设置为 PHP FPM

[英]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.我需要在.htaccess中修改php的memory_limit、max_input_vars和max_execution_time。为了不修改服务器上php的全局配置。

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:在 my.htaccess 中,我测试了这两个配置但没有成功:

<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?对于php7.3-fpm.sock ,我是否必须以其他方式使用它?

Thanks谢谢

in your configuration file, default path "/etc/php/7.3/fpm/pool.d/php7.3-fpm.conf" or your path, change to:在您的配置文件中,默认路径“/etc/php/7.3/fpm/pool.d/php7.3-fpm.conf”或您的路径,更改为:

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.然后重新启动您的 web 服务,并测试您的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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