LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2012, 02:12 PM   #16
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled

This worked perfectly using the terminal, but it won't send using the php script I included earlier. I am still getting this message: sh: usr/sbin/sendmail: not found
 
Old 04-12-2012, 03:04 PM   #17
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,466

Rep: Reputation: Disabled
OK, so sendmail (or something pretending to be sendmail) works. The access rights are fine, the executable is even SETGID root. Conclusion: Your problem has nothing to do with sendmail.

Which leads us back to the path: usr/sbin/sendmail is a relative path. Unless the command happens to be run from /, it will obviously fail to locate /usr/sbin/sendmail.

Change sendmail_path in php.ini to something obviously wrong, like /usr/bin/does_not_exist, and see if the entry in error.log changes accordingly.

You never did say if either php or apache were recently upgraded. When something that used to work suddenly stops working for seemingly no reason, upgrades are likely culprits.

Last edited by Ser Olmy; 04-12-2012 at 03:11 PM.
 
Old 04-12-2012, 03:45 PM   #18
oldFlurp
LQ Newbie
 
Registered: Apr 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
I have not upgraded anything since the initial install. I was wondering if there were some odd place to set the path besides php.ini as that would seem to be the most obvious problem. I changed the path in /etc/php5/apache2/php.ini and saw no change. Sendmail path is commented out in /etc/php5/cli/php.ini. One of the guys who works with me said he was messing around with virtual paths or something similar and might have changed this somehow. He said he read something on a forum and tried a change through the console but couldn't remember anything beyond that. ANy idea on how to check that in case that is where our problem lies?
 
Old 04-12-2012, 06:01 PM   #19
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,466

Rep: Reputation: Disabled
I've done some testing of my own, and I've successfully reproduced the problem.

First, I enabled PHP in Apache and created a dummy HTML page with a small PHP script:

Code:
<html>
<head><title>Sending mail with PHP</title></head>
<body>
Test of the PHP mail() function:<br><br>
<?php

echo ("Sending mail now, should be in your inbox in a few seconds.");
mail("user@domain.com", "This is a test message", "This is indeed a test message", "From: Your friendly php script");
?>
</body>
</html>
I accessed the page, and a few seconds later I had a new mail in my inbox (obviously, I specified a valid email address instead of "user@domain.com").

I then edited php.ini and changed the sendmail_path setting to read sendmail_path = usr/sbin/sendmail (note the missing slash at the beginning). I restarted Apache and refreshed the page. No mail was sent, and the following entry could be found in error_log:
sh: usr/sbin/sendmail: No such file or directory
Seems rather familiar. It looks like the setting you've been editing is either being overridden by another setting, or you're editing the wrong php.ini.

You could search for other files in /etc containing usr/sbin/sendmail with fgrep:

Code:
fgrep -r usr/sbin/sendmail /etc | less
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using /usr/sbin/sendmail to deliver message to local SMTP server enmingteo Linux - Server 9 05-07-2009 10:55 AM
127 Can't execute command '/usr/sbin/sendmail kiganda Linux - Newbie 1 10-03-2007 05:50 AM
Sendmail/Outlook problem (receiving is ok but cannot send) custangro Linux - Server 1 07-17-2007 12:23 AM
How to start '/usr/sbin/sendmail' auto ... ? emil+ Slackware 2 02-18-2006 11:50 AM
what should /usr/sbin/sendmail be chmoded to? ShawnD Linux - General 3 08-23-2002 12:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration