我可以从我的PHP代码中更改default_socket_timeout吗? [英] Can I change default_socket_timeout from my php code?
问题描述
在我的PHP脚本中,我恢复了db2数据库备份.他们越来越大.所以现在执行脚本后+ -30分钟后出现500服务器错误. php-errors.log文件中的(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 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.
我认为设置`set_time_limit(6000); 1可以解决问题,但没有解决.
I thought that setting `set_time_limit(6000);1 would solve the issue but it hasn't.
在php.ini文件中增加default_socket_timeout
可以达到目的.
Increasing default_socket_timeout
in php.ini file did the trick.
是否可以通过php代码更改default_socket_timeout
?
Is there any way to change default_socket_timeout
from php code?
推荐答案
使用此PHP命令:
ini_set("default_socket_timeout", 6000);
或使用以下行添加/更新.htaccess文件:
Or add/update the .htaccess file with this line:
php_value default_socket_timeout 6000
使用phpinfo()
这篇关于我可以从我的PHP代码中更改default_socket_timeout吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!