Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to set a different timeout and execution time for a third party server that needs to import the products and prices on my database.

Right now, they are telling me the php script is timing out. This is due to my configuration on php.ini. I'd like to be able to keep that configuration for everyone as I think that's the right configuration. But I also need them to be able to execute the script.

I guess there must be a way to do this either on nginx or php-fpm configurations. Anyone knows how?

share|improve this question
up vote 0 down vote accepted

You can use the second php-fpm backend and depending on source IP pass the request to new one. These are some examples.

  1. The php-fpm config wikth required memory limit and execution timeout:
listen = # use new TCP port/socket
php_admin_value[memory_limit] = xxM
php_admin_value[max_execution_time] = xx
  1. By using ngx_http_geo_module and if directive pass to second backend:
geo $import {
 default                0;
 64.95.xx.xx            1;
 80.84.xx.xx            1;

server {
  listen 80;
  location ~ \.php$ {
    include       fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    if ($import) {
    fastcgi_pass;      #default php-fpm backend
share|improve this answer

You can use the function "set_time_limit()" in your scripts to set the time limit for php script execution.


seconds = The maximum execution time, in seconds. If set to zero, no time limit is imposed.

so you should be able to do this for 15 minutes: set_time_limit(900);

or this for no limit: set_time_limit(0);

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.