Link to home
Start Free TrialLog in
Avatar of kenanerdey
kenanerdey

asked on

sendmail error

hi;

when i want to run sendmail it gives en error like "sendmail: fatal: unable to switch to qmail home directory". so i cant send mail from php using mail function. my system is suse 10.0. and running postfix 2.5.5. what is the problem ?

thanks.
Avatar of jar3817
jar3817

If you're already running postfix, why do you need sendmail? You can just edit your /usr/local/lib/php.ini file to use postfix for sending mail rather than sendmail from php.
Avatar of kenanerdey

ASKER

i found the problem. as i am running apache as root, when i used /usr/sbin/sendmail it didn't give error. so i changed php.ini with new path.  
by the way sendmail is the mail client of postfix (postfix's sendmail wrapper)
DON'T RUN APACHE AS ROOT.

If your webserver is compromised (by fault of an exploit in apache or php or any other module related to apache) and apache is running as root, you will have handed your server (and all it's data) over to the attacker on a silver platter.  As if you losing control of your server wasn't bad enough, it would probably end up pumping out spam which affects everyone else. Do us all a favor and don't run apache (or any other public facing service) as root.

As for your original question, the "sendmail: fatal: unable to switch to qmail home directory" sounds like a permission problem. Once you figure out which directory this message is referring to, you can make it read/writable by the non-root user apache is running as (apache,nobody,daemon, whatever).
do i have to do special to run it as user ( parameter or something) or just logon as user then run it ?
In your httpd.conf you have to have lines like this:

User  username
Group groupname

Instead of using hte names, you can use the uid and gid. If you don't have an apache user/group, you can use "nobody", that user and group should already exist on your system.
yes it's working as wwwrun. but when i do ps -ef i see a httpd process run as root. but there are other httpd process run as wwwrun.
i tried something. i wrote a php script taking a parameter and include it. when i run it as ...exam.php?t=/etc/passwd  it showed me passwd file. but it can only be read by root. so this is a problem. ideas ?
ASKER CERTIFIED SOLUTION
Avatar of jar3817
jar3817

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you are right. i thought it's only readable by root. you have the points.