I am having a tough time figuring out why the mail() builtin php function does not work on my server. I am running PHP 4.2.2. Slackware 8.0, sendmail 8.12.5.
Has anyone seen this? Could it be a php.ini or sendmail issue?
As far as I can tell, sendmail doesn't even get the message. But nothing complains. I don't see an error on the screen, nor in any logs. So I'm having trouble locating the problem. I would appreciate any help.
As a strange complication, I installed PHP in both the CGI mode and as an addon to Apache (I love to shell script in PHP). If I use the mail() function from a cgi/shell script it works perfectly. (yes the path to php is correct here)
#!/usr/local/php/bin/php
<?PHP
mail("xxxxx@xxxxxxx.com","Test","Body");
?>
I checked the path of the sendmail directive in the php.ini and it was blank, so I quickly set it. I restarted apache and this did not fix it. I also tried with some params and that did not work either.
sendmail_path="/usr/sbin/sendmail -t -i -OQueueDirectory=/var/spool/mqueue/"
Next, I setup a simple script to test for a value returned by mail().
<?PHP
$val = mail("xxxx@xxxx.com","Subject","Body");
print "V: $val\n";
?>
$val returned nothing (blank), not a 0. I also ran mailq right after and it showed 0 in the queue.
root@mail# mailq
/var/spool/mqueue is empty
Total requests: 0
If run from the command line:
#!/usr/local/php/bin/php
<?PHP
$val = mail("xxxx@xxxx.com","Subject","Body");
print "V: $val\n";
?>
It returns a 1, and I get the email as expected in my inbox.
I also pointed the php.ini to my /usr/bin/sendmail alias and even set permissions the same as the apache, without success.
I'm going bezerk. Any help would be appreciated.
Thanks
John