php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28454 cannot set sendmail_path in httpd.conf
Submitted: 2004-05-20 09:04 UTC Modified: 2004-05-20 14:13 UTC
From: bugs dot php dot net at phoenixdigital dot com Assigned:
Status: Not a bug Package: *Configuration Issues
PHP Version: 4.3.4 OS: Freebsd 4.9 Stable
Private report: No CVE-ID: None
 [2004-05-20 09:04 UTC] bugs dot php dot net at phoenixdigital dot com
Description:
------------
Hi,

We are having trouble getting emails sent from php to set the return-path header in messages. This is important as we host many sites from our servers and want bounces to go to the hosted sites address rather than our system address.

adding this line to the virtual host section in the apache conf.

php_value sendmail_path '/usr/sbin/sendmail -t -i -f cameron@phoenixdigital.com'

then checking the a page with phpinfo() in it the change is not visible.

We can set this value in the php.ini file perfectly but however we cannot set it on a site by site basis in the virtual hosts directive.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-20 09:08 UTC] bugs dot php dot net at phoenixdigital dot com
if possible can you please adjust the email address in my bug report to be a non real domain as I don't want my email to be trawled from this bug report.

please change it to
php_value sendmail_path '/usr/sbin/sendmail -t -i -f
cameron@this_domain.com'


Thanks
 [2004-05-20 12:26 UTC] derick@php.net
This is not a bug, but meant to work like this due to security reasons. (Ie, we don't want people to be able to configure their own sendmail path in .htaccess files).

The correct way of doing what you want is to use the php_admin_value mail.force_extra_parameters setting, which is configurable per vhost.. unfortunately that only works in PHP 5 (dev).

If you are comfortable patching, you can apply the following patch to php 4.3.6 (it should also apply to 4.3.4):

Index: main/main.c
===================================================================
RCS file: /repository/php-src/main/main.c,v
retrieving revision 1.512.2.53
diff -u -p -r1.512.2.53 main.c
--- main/main.c 9 Feb 2004 04:05:56 -0000       1.512.2.53
+++ main/main.c 20 May 2004 10:26:04 -0000
@@ -356,7 +356,7 @@ PHP_INI_BEGIN()
 #endif
        PHP_INI_ENTRY("precision",                                      "14",           PHP_INI_ALL,            OnSetPrecision)
        PHP_INI_ENTRY("sendmail_from",                          NULL,           PHP_INI_ALL,            NULL)
-       PHP_INI_ENTRY("sendmail_path",  DEFAULT_SENDMAIL_PATH,  PHP_INI_SYSTEM,         NULL)
+       PHP_INI_ENTRY("sendmail_path",  DEFAULT_SENDMAIL_PATH,  PHP_INI_SYSTEM|PHP_INI_PERDIR,          NULL)
        PHP_INI_ENTRY("disable_functions",                      "",                     PHP_INI_SYSTEM,         NULL)
        PHP_INI_ENTRY("disable_classes",                        "",                     PHP_INI_SYSTEM,         NULL)


But make sure to use php_admin_value sendmail_path "your command"  so that it can't be overridden from .htaccess files.
 [2004-05-20 12:33 UTC] bugs dot php dot net at phoenixdigital dot com
Then this is a documentation issue because on this page

http://au.php.net/ini_set

sendmail_path DEFAULT_SENDMAIL_PATH PHP_INI_SYSTEM 

where 
PHP_INI_SYSTEM 4 Entry can be set in php.ini or httpd.conf  

It claims you CAN set it in a httpd.conf NOT
 [2004-05-20 12:35 UTC] bugs dot php dot net at phoenixdigital dot com
Also you said I can't set in in .htaccess I am not being picky but I did state that I am trying to set it in the httpd.conf which is completely different.
 [2004-05-20 12:44 UTC] derick@php.net
It can be set in httpd.conf, just not in a virtual host setting.
 [2004-05-20 12:45 UTC] bugs dot php dot net at phoenixdigital dot com
Actually come to think of it I have moved this back into the config issues as a bug because you thought I was talking about a .htaccess file. 

It is fair enough that you limit the modification of sendmail_path in a .htaccess file.

However as the manual states you CAN modify this in the httpd.conf which is where we are trying to modify it. Since htttp.conf files are generally only controlled by administrators then this is not a security issue.
 [2004-05-20 13:21 UTC] edink@php.net
php_admin_value sendmail_path "blah" 
works just fine.
 [2004-05-20 13:36 UTC] bugs dot php dot net at phoenixdigital dot com
Thankyou :)

I thought that you could only set ini variables with this

php_value  sendmail_path "/usr/sbin/sendmail -t -i -f from@what.ever"

I did not know about this one.

php_admin_value  sendmail_path "/usr/sbin/sendmail -t -i -f from@what.ever"

It works perfectly. Sorry for submitting a bug but I found nothing in any newsgroup/google/mailing list regarding this problem and assumed it was bug.

Thanks for a great product people :)
 [2004-05-20 14:13 UTC] bugs dot php dot net at phoenixdigital dot com
I have posted an entry in the online php manual for this problem incase others come across it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 11:01:27 2024 UTC