大网数据广告活动
服务器运维问答

Setting max_execution_time for PHP7 and Nginx

· 52CE 我爱测

I followed this guide and updated the values: /etc/php/7.0/fpm/php.ini and change/add this: max_execution_time = 300 and /etc/php/7.0/fpm/pool.d/www.conf as well and change/add this: php_admin_value[max_execution_time] = 300 and …

问题原文

原帖链接 · Nimbuz · CC BY-SA 3.0

I followed this guide and updated the values:

/etc/php/7.0/fpm/php.ini and change/add this:

max_execution_time = 300

and /etc/php/7.0/fpm/pool.d/www.conf as well and change/add this:

php_admin_value[max_execution_time] = 300

and /etc/nginx/sites-available/example.com, and in the cgi section add:

fastcgi_read_timeout 300;

... followed by restarts but still:

# php -i | grep max_execution_time
max_execution_time => 0 => 0

This is the location block for my site:

location ~ .php$ {
    fastcgi_split_path_info ^(.+.php)(/.*)$;
    try_files $uri =404;
    fastcgi_keep_conn on;
    fastcgi_read_timeout 600;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

What am doing wrong?

已采纳解答

原帖链接 · Tero Kilkanen · CC BY-SA 3.0

When you run php -i from command line, it will use configuration settings for your PHP CLI client, which are likely located in /etc/php/7.0/cli/php.ini.

If you want to check settings for your PHP-FPM, create a script with following contents in your web root:

<?php phpinfo(); ?>

And then go to the script URL in your browser.

Another alternative that might work is to run php -b 127.0.0.1:9000 -i, which will make the PHP CLI connect to your FastCGI server to execute the command. You might need to change the address depending on your configuration.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-07-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。