I have two and more servers running PHP 5.4.45 with same scripts and none of them are doing any issue when calling a script that requires more than 60 seconds to finish.
However, a new server having PHP 5.6.31 is returning 503 timeout, when I run the same script. I tried everything found on the internet from keepAlive to timeout in httpd.conf and in php.ini, I already have
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 5);
Inside the code and all that. Same script same everything just different PHP version on 5.4.45 it works perfectly while on 5.6.31 I always get timeout unless when the full script executes in less than 60 seconds [I don't know where that limit comes from eventhough I changed anything related to 60 from the httpd.conf and php.ini) .
Kindly can you help me troubleshoot.
Related
I have a PHP script with infinity loop.
When I run this script using AJAX or directly in browser the server is trying to execute this script. The problem is: After 30 seconds the server is still executing the script. There is no "Maximum execution time exceeded" error. In the php.ini file max_execution_time is set to 30. Because of this problem, server is no longer usable. I can't run any other script by AJAX. I have to restart Apache in XAMPP.
Why the server didn't abort after 30 seconds?
I'm using XAMPP and XDebug.
// UPDATE 1:
PHP Script:
<?php
while(true)
echo 'test';
I know that this code have no sense. I just wondering, why the server didn't abort execution after 30 seconds...
**//UPDATE 2: ** I turned off XDebug, and change code to:
<?php
$x = 0;
while(true)
$x += 1;
Now it's ok: the server abort script after 30 sec with "max execution time" error.
However, the server still can't abort script with "echo" statement (even with with disabled XDebug). The same problem is when I try to execute script without "echo", but with enabled XDebug.
So, it seems to be problem when I use "echo" or "XDebug".
The script is corretly aborted only if there is no 'echo' and XDebug is disabled.
I ran into this issue as well. For me, once xdebug was enabled and autostarted, max_execution_time was set to 0 no matter what. I had to disable it to have it as a value. At least now I know that in my development environment, timeout testing is not possible while xdebug is enabled.
In my case, the script would get killed by the web server without running the register_shutdown_function. Since PHP wasn't handling the timeout, I'd get no errors except for the internal 500 error. Bugsnag wouldn't get notified.
I have make changes in my case in:
xampp\phpMyAdmin\libraries\config.default.php
search for : `$cfg['ExecTimeLimit']
You can change Right hand Value to any higher value, like '6000'.
and it works for me.
Done!
I turned off "Litening for PHP Debug Connections" in PHP Storm and the problem is solved.
I need help on resetting server timeout, at present, the php scripts on my linode servers timeout in 50 seconds, i have tried all options to increase the timeout time but nothing helps.
Environment -
Linode VPS
Server OS - UBuntu 12
Nginx
PHP / Fast CGI
apache
My Development is being done with CodeIgniter
I have a test script (test.php), with the following code -
<?php
sleep(70);
die( 'Hello World' );
?>
When I call this script through a browser, I Get a 504 Timeout Error.
I have setup the following -
PHP - set max_execution_time to 300, max_input time to 300
updated NGINX Configuration file with all the timeout variables (proxy, fastcgi etc)
Setup FastCGI to timeout after 600 seconds
Still my script timeouts at 50 seconds, i have reloaded nginx, rebooted vps, but the changes are not reflecting.
Please help me, this issue is turning me mad.
Sincerely,
I have a php script that need to be processed for one to 5 hours (sending newsletters to our customers). I tried both set_time_limit(2000); and ini_set('max_execution_time', 360000); but neither works. They work perfectly on the XAMPP local server, but they do not work on our dedicated server (Unix & Apache). I also changed the Apache timeout to 300 (which was 50), yet after 30 seconds of script running, it returns this:
Internal Server Error Page (Error 500)
I have no idea if there is any other place for timeout and/or why the server does not honor the ini_set() or set_time_limit() functions. We are using Unix CentOS 6 and Plesk 11.9 as server. I also changed the default php.ini max_execution_time, and it works...
I read many articles and forums, yet I don't know why this happens. I appreciate your help.
// add, in your php file header or config
ini_set('max_execution_time','256'); //max_execution_time','0' <- unlimited time
ini_set('memory_limit','512M');
Good work!
a better way would be using ini_set() or set_time_limit() at the top of the script which sends newsletters to the customers...you should not try to main config files...and also, as someone suggested above, cron jobs are good fit for such situations..
I appreciate your answers and comments. I setup the cron job, and it works perfect. I also have tried the chunk-chunk (150 emails per chunk) approach, and that one works too.
If you using Vps:
Edit your php.ini file:
max_execution_time = 256
memory_limit = 512M
Then, run command line to restart apache
service httpd restart
Or header file
ini_set('max_execution_time','256');
ini_set('memory_limit','512M');
Good luck!
I'm running the following setup:
- Windows 2008 web edition
- IIS 7
- Plesk 9.5
- FastCGI
PROBLEM DESCRIPTION
When running a script that takes longer than 30 seconds, I get the 500 internal server error message and not the "normal" response ("max execution time of 30 seconds is reached"). Also, this message always appears after about 40 secondes. Also, after putting set_time_limit(3600); into the code this same results happen.
ACTUAL RESULT
Both with and without the set_time_limit code:
After about 40 seconds a 500 internal server error appears
EXPECTED RESULT
Without set_time_limit:
After 30 seconds a message will appear saying the 30 seconds max execution limit is reached.
With set_time_limit:
The full script runs with a max of the number of seconds set in the set_time_limit
ADITIONAL NOTE
The problem is solved when running CGI in stead of FastCGI.
Can anybody help me?
I could found some links that could help you. The problem is the activityTimeout of your cgi module.
Increase fastCgi / PHP activityTimeout in IIS7
FastCGI timeout value change
For my, works in summary this.
Open the dos console "cmd" and go to
c:\windows\system32\inetsrv\
then, execute this command, changing the path of your php-cgi.
appcmd set config -section:system.webServer/fastCgi "-[fullPath='C:\php\php-cgi.exe'].activityTimeout:3600"
I hope this help you!
My configuration:
Apache 2.2.4
PHP 5.2.4 (fastCGI)
Windows XP pro
I have a script that takes more than a minute to run but after exactly 60 seconds (proven by Fiddler) the server always delivers a 408 timeout. My PHP max execution time is set to 120 seconds. After doing some reading I've tried putting a "Timeout 120" directive in my Apache config file though I'm not confident that directive relates to what I'm trying to do. No dice. Is there any way to make apache wait longer before returning the 408? (Yes, I've restarted the web server between making config changes). Many thanks for any guidance.
Try setting the -appConnTimeout parameter in the FastCgiServer directive.
I am not sure which one of these lines solves the problem; probalby the execution time - but it solved my 408 problems (added to settings.php):
$conf['drupal_http_request_fails'] = FALSE;
ini_set('max_execution_time', '600');
ini_set('memory_limit', '512M');
ini_set('upload_max_filesize', '128M');
ini_set('post_max_size', '128M');
ini_set('query_cache_size', '128M');