Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a web application which is processing some data on server side. I am requesting this process with a post request.

The problem is that if I have a big amount of data, I will get a timeout. I am usig a ngnix server with PHP.

The error I am getting is 404 Not Found.

Do you know how is it possible to increase the timeout?

Thank you.

share|improve this question
    
Either there is a configuration option to specify a higher timeout or you have to edit the source code of the web application in question. –  scai Jan 3 '13 at 15:41
    
Thank you @scai, but where to find the configuration option on the server, or in the browser? –  Milos Jan 3 '13 at 15:44
3  
Which is the server? Apache? And which is the language of the server side page? Php? Asp? Tell us more –  Davide Berra Jan 3 '13 at 15:47
1  
It is a ngnix server and the language used is the PHP. Sorry for missing those information. –  Milos Jan 3 '13 at 15:49
    
In php you can use max_execution_time = 60 inside php.ini. 60 seconds is just an example. This link will help you - stackoverflow.com/questions/3829403/… –  Suku Jan 3 '13 at 15:55

1 Answer 1

up vote 1 down vote accepted

PHP

To increase PHP execution timeout, increase in php.ini. To see where your php.ini is located, see phpinfo().

max_execution_time = 60 #this is in seconds

nginx

To increase nginx's timeout on reading from backend, increase in nginx config (nginx/nginx.conf).

proxy_read_timeout 60

More: http://wiki.nginx.org/HttpProxyModule#proxy_read_timeout

cURL

This is an assumption, but since you say you are making a POST request, increase cURL timeout

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0); 
curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds

More: http://www.php.net/manual/en/function.curl-setopt.php

Misc

Be sure to set timeouts with precedence in mind. PHP will keep processing even if nginx decided to stop listening. etc.

share|improve this answer
    
Thank you very much @Peter, in fact, I am using a backend application to process data and I am getting a 404 not found error after something like 15 seconds, éore and less. Which solution should I use in this case? –  Milos Jan 3 '13 at 16:10
    
I don't know how you are exactly pulling that data. Could it be actually not found -- ie 404? Timeouts shouldn't technically give you a 404 error. Timeout is 408. But if timeout is really the cause, you'd want to increase all of them to at least maximum you set on cURL (if you're using curl). nginx >= php >= curl. –  Grumpy Jan 3 '13 at 16:13
    
Hm, ok. Strange. But if I will change for example the max_execution_time I will need to restart the php, right? –  Milos Jan 3 '13 at 16:22
    
Yes, restarting the php processor is required, as is nginx reload. –  Grumpy Jan 3 '13 at 16:25
    
Ok, I think i will try to find another solution because this code is running on our production server and I can't restart it. Thank you very much for your help, I will confirm your answer. –  Milos Jan 3 '13 at 16:26

Your Answer

 
discard

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.