0

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?

2 Answers 2

0

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:
 [import] listen = 127.0.0.1:9001 # 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;   server_name example.com;   ... location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; if ($import) { fastcgi_pass 127.0.0.1:9001; break; } fastcgi_pass 127.0.0.1:9000; #default php-fpm backend } ... } 
0

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

Parameters:

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);

http://php.net/manual/en/function.set-time-limit.php

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.