1

I need to make PHP execution longer, and whatever else might be a problem. I thought I'd already done so but I'm still getting gateway timeouts from my recent wordpress install. The php-fpm pool has the following configuration

[john]
user = john
group = john

listen = 127.0.0.1:9002
listen.owner = www
listen.group = www

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

php_admin_value[max_execution_time] = 300
php_admin_value[max_input_time] = 120

The syntax is okay but with scripts timing out in about 30 seconds I wonder what else I have missed. It might be overkill but I'm in a hurry and will learn later, feel free to explain, but if someone could tell me all the values I could increase to hit this problem with brute force and solve it that would be great.

John Tate
  • 179
  • 4
  • 19
  • Do you have a proxy/load balancer in front of you web server? Gateway timeout is a typical error generated by proxy or load balancer (HAProxy, Pound, etc) – lg. Sep 02 '13 at 12:10

2 Answers2

1

I'd start by setting max input and execution time manually in your php.ini instead of trying to override any setting on php-fpm or nginx.

ffflabs
  • 111
  • 3
0

In /etc/php5/fpm/pool.d/www.conf add this line:

request_terminate_timeout = 180

Also, in /etc/nginx/sites-available/default add the following line to the location block of the server in question:

fastcgi_read_timeout 180;

The entire location block looks like this:

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_read_timeout 180;
    include fastcgi_params;
}

Now just restart php-fpm and nginx and there should be no more timeouts for requests taking less than 180 seconds.

Harikrishnan
  • 1,057
  • 2
  • 14
  • 31