Re: Possible issue in mail() function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/11/10 16:54, Richard Quadling wrote:
> On 26 November 2010 15:12, Tom Hendrikx <tom@xxxxxxxxxxxxx> wrote:
>> On 26/11/10 15:54, Richard Quadling wrote:
>>> On 25 November 2010 21:30, Tom Hendrikx <tom+php.net@xxxxxxxxxxxxx> wrote:
>>>> Hi,
>>>>
>>>> I noticed that the mail() function in php 5.3.3 on gentoo linux triggers
>>>> a warning when used. A simple debug script with the contents:
>>>>
>>>> <?php
>>>> // recipient, subject, body
>>>> mail("some@xxxxxxxxxxx", "mail() test", "This is a test");
>>>> ?>
>>>>
>>>> does send mail, but it also raises a warning:
>>>>
>>>> Warning: mail(1): failed to open stream: Permission denied in
>>>> /var/www/www.example.com/htdocs/test-mail/index.php on line 5
>>>>
>>>> After some googling [1] and fiddling with permissions, the message
>>>> disappears when php has write permissions to the file
>>>> /var/www/www.example.com/htdocs/test-mail/1 , in which it writes the
>>>> following data:
>>>
>>> Are you logging your emails via the ini setting mail.log? Maybe this
>>> is the issue.
>>>
>>
>> Erh, actually, yes I am. Documentation of the setting is rather sparse,
>> but I enabled it some time ago, expecting it to send the data to the
>> logging facility (syslog in my case), after which I forgot to check if
>> that actually happens. The current implementation is rather useless (to
>> me), so I turned it off again.
>>
>> Thanks for the tip, but I think that this is actually a bug? Current way
>> of logging is not very useful, since the file '1' is overwritten (in
>> stead of appended to) with new data at every run of the mail() function.
>>
>> --
>> Regards,
>>        Tom
>>
>>
> 
> I'm on windows and my mail.log shows me all the mail I've sent using
> the mail() command since I turned it on.
> 
> But according to
> http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/ext/standard/mail.c?view=markup#l227,
> the mail.log file is opened in append mode.
> 
> I'm guessing PHP isn't responsible here.
> 

Actually, now I understand. I set mail.log to '1', enabling it as a
boolean and expecting it to send the output to whatever error_log points
to. In stead, mail.log expects a string, the path where to log to.

Documentation of the setting is quite sparse, and I failed to notice
that the config option wants a string and no boolean. Mystery solved :)

--
Regards,
	Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux