Welcome! Log In Create A New Profile

Advanced

php + sendmail

Posted by Illó Gábor 
Illó Gábor
php + sendmail
August 20, 2010 04:18AM
Hi.

i have php-fpm 5.3.3 in my jail (FreeBSD) and mail() not working return
false

sendmail_from*no value**no value* sendmail_path/usr/sbin/sendmail -t -i
/usr/sbin/sendmail -t -i

hosting# sockstat -4 | grep sendmail
root sendmail 42300 3 tcp4 172.20.0.1:25 *:*
root sendmail 42300 5 tcp4 172.20.0.1:587 *:*

hosting# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 hosting.stageline.hu ESMTP Sendmail 8.14.4/8.14.4; Fri, 20 Aug 2010
10:10:03 +0200 (CEST)
QUIT
221 2.0.0 hosting.stageline.hu closing connection
Connection closed by foreign host.


I install 5.3.3 FPM sapi only.

Any idea?

--
Best Regards
Gábor Illó
Jérôme Loyet
Re: php + sendmail
August 20, 2010 04:30AM
2010/8/20 Illó Gábor <stageline@gmail.com>
>
> Hi.

Hi,

please, use text format in your mail.

>
> i have php-fpm 5.3.3 in my jail (FreeBSD) and mail() not working return false

You can check mini_sendmail
(http://www.acme.com/software/mini_sendmail/). search for
mini_sendmail on google, you'll have a lots of hits.

>
> sendmail_fromno valueno value
> sendmail_path/usr/sbin/sendmail -t -i/usr/sbin/sendmail -t -i
>
> hosting# sockstat -4 | grep sendmail
> root     sendmail   42300 3  tcp4   172.20.0.1:25         *:*
> root     sendmail   42300 5  tcp4   172.20.0.1:587        *:*
>
> hosting# telnet localhost 25
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 hosting.stageline.hu ESMTP Sendmail 8.14.4/8.14.4; Fri, 20 Aug 2010 10:10:03 +0200 (CEST)
> QUIT
> 221 2.0.0 hosting.stageline.hu closing connection
> Connection closed by foreign host.
>

the sendmail binary does not communicate trough TCP but through files
in /var/spool/. mini_sendmail will emulate this behaviour from inside
the jail.

>
> I install 5.3.3 FPM sapi only.
>
> Any idea?
>
> --
> Best Regards
> Gábor Illó
Re: php + sendmail
August 20, 2010 04:30AM
quick note: sendmail_from is only used on windows, according to the manual
http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-from

does /usr/sbin/sendmail exist inside of the jail? can you manually trigger
it properly?

check the php error logs. perhaps it will tell you something. turn up your
error logging.

On Fri, Aug 20, 2010 at 1:16 AM, Illó Gábor <stageline@gmail.com> wrote:

> Hi.
>
> i have php-fpm 5.3.3 in my jail (FreeBSD) and mail() not working return
> false
>
> sendmail_from*no value**no value* sendmail_path/usr/sbin/sendmail -t -i
> /usr/sbin/sendmail -t -i
>
> hosting# sockstat -4 | grep sendmail
> root sendmail 42300 3 tcp4 172.20.0.1:25 *:*
> root sendmail 42300 5 tcp4 172.20.0.1:587 *:*
>
> hosting# telnet localhost 25
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 220 hosting.stageline.hu ESMTP Sendmail 8.14.4/8.14.4; Fri, 20 Aug 2010
> 10:10:03 +0200 (CEST)
> QUIT
> 221 2.0.0 hosting.stageline.hu closing connection
> Connection closed by foreign host.
>
>
> I install 5.3.3 FPM sapi only.
>
> Any idea?
>
> --
> Best Regards
> Gábor Illó
>
Illó Gábor
Re: php + sendmail
August 20, 2010 05:24AM
2010/8/20 Michael Shadle <mike503@gmail.com>
>
> quick note: sendmail_from is only used on windows, according to the manual
> http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-from
> does /usr/sbin/sendmail exist inside of the jail? can you manually trigger it properly?

Yes
hosting# file /usr/sbin/sendmail
/usr/sbin/sendmail: symbolic link to `/usr/sbin/mailwrapper'

> check the php error logs. perhaps it will tell you something. turn up your error logging.

No errors in php error log
log_errors On
error_log /var/log/php_errors.log
Illó Gábor
Re: php + sendmail
August 20, 2010 07:26AM
2010/8/20 Jérôme Loyet <ml@fatbsd.com>:

> You can check mini_sendmail
> (http://www.acme.com/software/mini_sendmail/). search for
> mini_sendmail on google, you'll have a lots of hits.

ok mini_sendmail installed and linked to the php chroot directory

ln -s /usr/local/bin/mini_sendmail /usr/local/www/sendmail

php-fpm.conf:

chroot = /usr/local/www/
php_admin_value[sendmail_path] = /sendmail -t -i

>
> the sendmail binary does not communicate trough TCP but through files
> in /var/spool/. mini_sendmail will emulate this behaviour from inside
> the jail.

php return false if i sending mail.
Thx.
Jérôme Loyet
Re: php + sendmail
August 20, 2010 07:56AM
2010/8/20 Illó Gábor <stageline@gmail.com>:
> 2010/8/20 Jérôme Loyet <ml@fatbsd.com>:
>
>> You can check mini_sendmail
>> (http://www.acme.com/software/mini_sendmail/). search for
>> mini_sendmail on google, you'll have a lots of hits.
>
> ok mini_sendmail installed and linked to the php chroot directory
>
> ln -s /usr/local/bin/mini_sendmail /usr/local/www/sendmail
>
> php-fpm.conf:
>
> chroot = /usr/local/www/
> php_admin_value[sendmail_path] = /sendmail -t -i
>
>>
>> the sendmail binary does not communicate trough TCP but through files
>> in /var/spool/. mini_sendmail will emulate this behaviour from inside
>> the jail.
>
> php return false if i sending mail.

try make it works directly from a shell. When this will work, you'll
be able to test it on PHP

or try to strace the process :)

> Thx.
>
Illó Gábor
Re: php + sendmail
August 20, 2010 08:38AM
> 2010/8/20 Jérôme Loyet <ml@fatbsd.com>:
> try make it works directly from a shell. When this will work, you'll
> be able to test it on PHP
>
> or try to strace the process :)
>

How test with strace?

strace /usr/local/etc/rc.d/php-fpm start ?
Jérôme Loyet
Re: php + sendmail
August 20, 2010 08:50AM
2010/8/20 Illó Gábor <stageline@gmail.com>:
>> 2010/8/20 Jérôme Loyet <ml@fatbsd.com>:
>> try make it works directly from a shell. When this will work, you'll
>> be able to test it on PHP
>>
>> or try to strace the process :)
>>
>
> How test with strace?
>
> strace /usr/local/etc/rc.d/php-fpm start ?
>

google strace you'll find hundreds of exemples
Illó Gábor
Re: php + sendmail
August 20, 2010 08:52AM
2010/8/20 Illó Gábor <stageline@gmail.com>:
>> 2010/8/20 Jérôme Loyet <ml@fatbsd.com>:
>> try make it works directly from a shell. When this will work, you'll
>> be able to test it on PHP
>>
>> or try to strace the process :)
>>
>
> How test with strace?
>
> strace /usr/local/etc/rc.d/php-fpm start ?
>

strace is only for i386 but i use amd64 :-/

--
Best Regards
Gábor Illó
Jérôme Loyet
Re: php + sendmail
August 20, 2010 08:54AM
2010/8/20 Illó Gábor <stageline@gmail.com>:
> 2010/8/20 Illó Gábor <stageline@gmail.com>:
>>> 2010/8/20 Jérôme Loyet <ml@fatbsd.com>:
>>> try make it works directly from a shell. When this will work, you'll
>>> be able to test it on PHP
>>>
>>> or try to strace the process :)
>>>
>>
>> How test with strace?
>>
>> strace /usr/local/etc/rc.d/php-fpm start ?
>>
>
> strace is only for i386 but i use amd64 :-/

Strace is similar to the native BSD ``truss'' utility. Use truss instead.

If you never used it and don't even know what it is, it's maybe not a
good idea to use this. I don't know the freebsd jail env, I can't
really help you. You can maybe ask on the freebsd user mailinglist.
There will be more accurate answers.

>
> --
> Best Regards
> Gábor Illó
>
Illó Gábor
Re: php + sendmail
August 20, 2010 08:58AM
2010/8/20 Jérôme Loyet <ml@fatbsd.com>:
>
> Strace is similar to the native BSD ``truss'' utility. Use truss instead.
>
> If you never used it and don't even know what it is, it's maybe not a
> good idea to use this. I don't know the freebsd jail env, I can't
> really help you. You can maybe ask on the freebsd user mailinglist.
> There will be more accurate answers.
>

I think is not FreeBSD question is simple php-fpm & php chroot question :p
Jérôme Loyet
Re: php + sendmail
August 20, 2010 09:08AM
2010/8/20 Illó Gábor <stageline@gmail.com>:
> 2010/8/20 Jérôme Loyet <ml@fatbsd.com>:
>>
>> Strace is similar to the native BSD ``truss'' utility. Use truss instead..
>>
>> If you never used it and don't even know what it is, it's maybe not a
>> good idea to use this. I don't know the freebsd jail env, I can't
>> really help you. You can maybe ask on the freebsd user mailinglist.
>> There will be more accurate answers.
>>
>
> I think is not FreeBSD question is simple php-fpm & php chroot question :p
>

yes it is but if you want to debug you'll have to use freebsd tools.
If you don't know how to use them, you have to ask the right persons.
Illó Gábor
Re: php + sendmail
August 20, 2010 09:10AM
2010/8/20 Jérôme Loyet <ml@fatbsd.com>:
>
> yes it is but if you want to debug you'll have to use freebsd tools.
> If you don't know how to use them, you have to ask the right persons.
>

Ok ok. Thanks so much for you reply!

--
Best Regards
Gábor Illó
Re: php + sendmail
August 21, 2010 06:50AM
You can easily set your script to send email from smtp ( localhost:
25 )
For example joomla has this function in Global Settings -> Server .
I tried to use /sbin/sendmail to send email in php-fpm with chroot
jail but it was unsuccessfull.

On Aug 20, 5:09 pm, Illó Gábor <stagel...@gmail.com> wrote:
> 2010/8/20 Jérôme Loyet <m...@fatbsd.com>:
>
>
>
> > yes it is but if you want to debug you'll have to use freebsd tools.
> > If you don't know how to use them, you have to ask the right persons.
>
> Ok ok. Thanks so much for you reply!
>
> --
> Best Regards
> Gábor Illó
Gabor Illo
Re: php + sendmail
August 21, 2010 07:32AM
2010/8/21 Mostafa Ghadamyari <m.ghadam@gmail.com>:
> You can easily set your script to send email from smtp ( localhost:
> 25 )
> For example joomla has this function in Global Settings -> Server .
> I tried to use /sbin/sendmail to send email in php-fpm with chroot
> jail but it was unsuccessfull.
>
Thank you! Working fine with phpmailer

$mail->IsSMTP();
$mail->Host = "127.0.0.1";
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 299
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready