Re: mail() only working with php-cli
| From: | Richard Lynch | Date: | Mon, 07 May 2007 23:00:32 +0000 |
| Subject: | Re: mail() only working with php-cli | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254521@lists.php.net to get a copy of this message | ||
On Sat, May 5, 2007 3:53 pm, Andy B. wrote:
> Is there any way to debug the mail() function within PHP4 or PHP5?
Check Apache error logs.
Check sendmail (or whatever) error logs.
> The following code is not working when called from a browser, but it
> does
> work from the command line:
Often points to a paths/permissions problem...
Can you 'su' to the Apache/PHP User and *then* run sendmail on command
line?
> php and php-cli use the same php.ini file. Php via Apache is launched
> as a
> module, NOT as CGI!
>
> sendmail_path is correctly set to /usr/sbin/sendmail -t -i
You put quotes around that in php.ini, right?...
Cuz it needs the quotes, last I checked:
sendmail_path = "/usr/sbin/sendmail -t -i"
> the /var/log/mail.log only shows activity when I try my code via
> command
> line, so my best guess is that sendmail is never reached when run from
> the
> browser.
>
> I went a little deeper and modified the sendmail_path to /tmp/test.sh,
> which
> contains:
>
> #!/bin/bash
> echo "I was used!!" > /tmp/test.log
>
> (chmod 777 /tmp/test.sh)
>
> Again I tried my script from the web and from the command line. Same
> result... command line is fine and generates the test.log file. In the
> browser no log file is created.
Hmmm. That blows away the quotes as an issue, at least until you got
back to using multi-word path...
Was sendmail installed when you compiled PHP, so PHP "knows" that it
should be able to use it?
Or, the short version of that question:
Does <?php phpinfo();?> show you 'mail' as an installed extension?
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?