PHP mail()超时 [英] PHP mail() timeout
问题描述
首先几个信息:
- Debian Squeeze
- PHP 5.3.3
- 具有mod_cgi的PHP
- 在这种情况下,我绝对必须使用
mail()
对于我所有的其他项目,我已经使用SMTP邮件了。
- Debian Squeeze
- PHP 5.3.3
- PHP with mod_cgi
- I absolutely HAVE to use
mail()
in this case. For all my other projects I already use SMTP mailing.
我已经将网站超时的问题与PHP mail()
函数。这是我的服务器上test.php文件中唯一的代码行:
I have isolated the problem of a site timeout to the PHP mail()
function. This is the only line of code in a test.php file on my server:
<?php mail('rudolf@geardev.de', 'test', 'test');
这似乎是无止境的,40秒后被mod_cgi终止。命令
Which seems to take endless and is then terminated by mod_cgi after 40 seconds. The command
php -r "mail('rudolf@geardev.de', 'test', 'test');"
在命令行上立即发送电子邮件。
on the command line sends the email instantly.
请告诉我你想看哪些日志文件,Apache日志是这样的:
Please tell me which log files you want to see, the Apache log is this:
[Thu Jan 17 12:17:00 2013] [warn] [client 178.15.148.43] mod_fcgid: read data timeout in 40 seconds
[Thu Jan 17 12:17:00 2013] [error] [client 178.15.148.43] Premature end of script headers: test.php
我认为问题是我不小心运行了 chmod -R 775
在根目录前几天。我已经修复了所有错误,除了这一个。
I think the problem is that I accidentally ran chmod -R 775
on the root directory a few days ago. I fixed all errors already, besides this one.
推荐答案
很可能你使用2个不同的php.ini版本。一个用于cli,一个用于cgi。 Debian有这样的设置我相信。
Most likely you use 2 different php.ini versions. one for cli and one for cgi. Debian have this setup i believe.
- /etc/php5/cgi/php.ini
- / etc / php5 / cli / php.ini
确保您的cli和cgi版本具有相同的电子邮件配置,它将工作。
Make sure that your cli and cgi versions have the same email configuration and it will work.
邮件配置密钥是:
[邮件功能]
The mail configuration key is: [mail function]
另一种可能性是您的网络用户没有访问权限到执行 sendmail。
Another possibility is that your web user does't have access to execute sendmail.
还检查假脱机权限(更新)
Also check spool permissions (updated)
这篇关于PHP mail()超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!