20

In my php script I restore db2 database backups. They are getting bigger and bigger. So now I was getting 500 Server Error after +-30min after executing the script. There was this line in (mod_fastcgi.c.3352) response not received, request sent: 634 on socket: tcp:127.0.0.1:9090 for /wrational/restoredb.php?mode=restore&database=RATIONAL, closing connection in php-errors.log file.

I thought that setting `set_time_limit(6000);1 would solve the issue but it hasn't.

Increasing default_socket_timeout in php.ini file did the trick.

Is there any way to change default_socket_timeout from php code?

0

3 Answers 3

41

With this PHP command:

ini_set("default_socket_timeout", 6000);

Or add/update the .htaccess file with this line:

php_value default_socket_timeout 6000

Check the current value with phpinfo()

Sign up to request clarification or add additional context in comments.

1 Comment

I get an internal error: The server encountered an internal error or misconfiguration and was unable to complete your request. when I add php_value default_socket_timeout 6000 to my .htaccess file.
6

beware of the fact, that php has a bug with default_socket_timeout and SSL. It will wait endless in case you use HTTPS/SSL.

https://bugs.php.net/bug.php?id=41631

3 Comments

the bug was fixed in recent php versions - 5.4.33 - 5.5.17 - 5.6.0-rc4
Is it fixed in 7.x versions?
If it is fixed in 5.4 then it's fixed in 7 for sure.
1

you can add/update the .htaccess file line php_value default_socket_timeout 6000

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.