开发者

PHP mail() failing after database connection

In my PHP program, I am having trouble with the mail() function.

I can call it in my scripts anywhere up until this line:

$this->db_conn = mysqli_connect($this->db_host, $this->db_user, $this->db_pass);

If I put a call to the mail function immediately before it, mail() succ开发者_高级运维eeds and returns true. If I put mail() right after this line, mail() fails and returns false.

Why could this be happening?

EDIT: The rest of my script continues as normal after the mail() call. This wasn't an issue until recently. Is there some PHP/Apache setting that might have been changed?

EDIT2: Didn't notice it before, but there is indeed a Warning showing up:

PHP Warning:  mail() [<a href='function.mail'>function.mail</a>]: Could not execute mail delivery program '/usr/lib/sendmail -t -i'

What could mysqli_connect() be doing to prevent the mail program from functioning?

EDIT3: This is server is running Solaris with Apache web server. For now, I've switched PHPMailer over to using SMTP mode which is working fine. Still trying to figure out what is going wrong with mail() though.


The web server may be running out of available file descriptors, or hitting its file descriptor limit.


The problem is almost certainly the database connection - check the connectionstring is working and maybe output something ( some trace data to do with those databas variables would be the obvious choice ) in the following line ahead of your mail() call to check what is going on and whether that is working.

The database log may let you know if you are having problems with credentials.


Check your logs to see if it reports any reason for the mail() or database call to fail.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜