Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-12-2008, 01:08 PM
|
#1
|
Member
Registered: Sep 2008
Posts: 90
Rep:
|
Sendmail - PHP not working with it
Hello all,
I have asked this in a PHP forum, but I think I have identified the problem to be more related to sendmail not accepting PHP to send emails.
I migrated to a new server (Fedora 9) everything works fine but sending mail via php. In my php.ini:
Code:
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
Path to sendmail /usr/sbin/sendmail -t -i
Sendmail works fine since I can send mail from it like so:
Code:
[root@localhost] echo "Test" | mail -s "Sup Dude" myemail@googlemail.com
But the mail function in PHP always failes!
Is there something I need to do to connect PHP and sendmail?
Really need help on this!
Thanks all
|
|
|
12-12-2008, 01:08 PM
|
#2
|
Member
Registered: Sep 2008
Posts: 90
Original Poster
Rep:
|
According to /var/log/maillog:
Code:
Dec 12 17:59:46 localhost sendmail[2345]: NOQUEUE: SYSERR(apache): /etc/mail/sendmail.cf: line 0: cannot open: Permission denied
So apache isn't allowed to view the configuration for sendmail, is it fine just to open permission to all?
Should apache be added to the trusted users list of sendmail?
|
|
|
12-12-2008, 01:53 PM
|
#3
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: 
|
No don't open up the permissions. That problem looks like the it is in your php.ini. I will see if I can find something. I remember coming across a document with similar problems but had a solution.
|
|
|
12-12-2008, 01:57 PM
|
#4
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: 
|
try just using /usr/sbin/sendmail. See what results that yeilds. After change you may have to reload apache. you may have to give read access to the sendmail.cf file though.
|
|
|
12-12-2008, 02:47 PM
|
#5
|
Member
Registered: Sep 2008
Posts: 90
Original Poster
Rep:
|
Hey jstephens84,
Thank you for your reply. I changed the php.ini file and restarted apache with the change you suggested but I still can't send emails from the php mail function, always returns false. And the log has the same thing in it:
Code:
Dec 12 21:45:44 localhost sendmail[2526]: NOQUEUE: SYSERR(apache): /etc/mail/sendmail.cf: line 0: cannot open: Permission denied
Here are the permissions for sendmail.cf:
Code:
-rw-r--r-- 1 root root 58624 2008-03-29 12:27 sendmail.cf
-rw-r--r-- 1 root root 7205 2008-03-29 12:27 sendmail.mc
What else can I try?
Thanks
|
|
|
12-12-2008, 03:58 PM
|
#6
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: 
|
Try checking to see if you have selinux turned on. If you do then it may be blocking the access to that service. look in grub.conf and see if you see anything like selinux=0 or 1
0 = permissive mode
1 = enforcement mode
you can also check at /boot/grub/grub.conf
FC 3 and above uses selinux by default unless you turn it off during startup.
|
|
|
12-12-2008, 04:29 PM
|
#7
|
Member
Registered: Sep 2008
Posts: 90
Original Poster
Rep:
|
There was nothing in grub.conf??
But when I type sestatus i get:
Code:
[root@localhost ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 23
Policy from config file: targeted
CRAP! How do I change the following to on?
Code:
[root@localhost ~]# sestatus -b | grep sendmail
httpd_can_sendmail off
|
|
|
12-12-2008, 04:39 PM
|
#8
|
Member
Registered: Sep 2008
Posts: 90
Original Poster
Rep:
|
I changed it and a lot of other things, restarted sendmail and httpd and no difference! HELP! 
Code:
httpd_builtin_scripting on
httpd_can_network_connect on
httpd_can_network_connect_db on
httpd_can_network_relay on
httpd_can_sendmail on
httpd_enable_cgi on
httpd_enable_ftp_server off
httpd_enable_homedirs on
httpd_execmem off
httpd_ssi_exec off
httpd_tty_comm on
httpd_unified on
httpd_use_cifs off
httpd_use_nfs off
|
|
|
12-12-2008, 06:25 PM
|
#9
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: 
|
This is going to sound crazy but try a reboot. Not sure if you have done that yet but lets just humor ourselves for a moment. We may also want to fully turn SElinux off. Can't help much as I am not a big fan of SE so I always just turned it off. So I have little to no experience with it.
|
|
|
12-13-2008, 08:42 AM
|
#10
|
Member
Registered: Sep 2008
Posts: 90
Original Poster
Rep:
|
This is really getting me down now!
I have rebooted switched off SElinux and put it in permissive mode too and tried to send emails which still doesn't work!
Why not add apache user to the allowed users list?
Are these settings ok?
Code:
[root@localhost ~]# sestatus -b | grep httpd
allow_httpd_anon_write off
allow_httpd_dbus_avahi off
allow_httpd_mod_auth_ntlm_winbind off
allow_httpd_mod_auth_pam off
allow_httpd_sys_script_anon_write off
httpd_builtin_scripting on
httpd_can_network_connect on
httpd_can_network_connect_db on
httpd_can_network_relay on
httpd_can_sendmail on
httpd_enable_cgi on
httpd_enable_ftp_server off
httpd_enable_homedirs on
httpd_execmem off
httpd_ssi_exec off
httpd_tty_comm on
httpd_unified on
httpd_use_cifs off
httpd_use_nfs off
|
|
|
12-13-2008, 01:33 PM
|
#11
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: 
|
Adding apache to the allowd user list should be fine. Earlier I thought you meant changing say the permissions of the sendmail.cf file to 777. That was my fault.
|
|
|
12-13-2008, 02:34 PM
|
#12
|
Member
Registered: Sep 2008
Posts: 90
Original Poster
Rep:
|
I could cry! Apache is already in the trusted users list!
Code:
# trusted-users - users that can send mail as others without a warning
# apache, mailman, majordomo, uucp, are good candidates
Although when I look at the mailog, I tried it send an email and I get:
Code:
Dec 13 21:32:17 localhost sendmail[7488]: mBDLWHNk007488: from=apache, size=61, class=0, nrcpts=0, msgid=<200812132132.mBDLWHNk007488@localhost.localdomain>, relay=apache@localhost
It use to deny it like this:
Code:
Dec 12 21:45:44 localhost sendmail[2526]: NOQUEUE: SYSERR(apache): /etc/mail/sendmail.cf: line 0: cannot open: Permission denied
I am not even sure what I have changed?!
Btw, jstephens84 - thank you for sticking with me in resolving the issue and before YOU are right, I did mean changing the permissions of the sendmail.cf file. :P
|
|
|
12-13-2008, 05:03 PM
|
#13
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: 
|
Well that is good to see that it works now. Too bad we don't know how we fixed it so someone else could benefit but oh well. That is how it goes sometimes. It works and you have no clue how it started.
|
|
|
12-13-2008, 05:24 PM
|
#14
|
Member
Registered: Sep 2008
Posts: 90
Original Poster
Rep:
|
I know, I wish I knew what was going on, but a slight problem :P There is no email in my inbox and the mail function still returns false even though the maillog seems to suggest its fine!
Code:
Dec 14 00:18:01 localhost sendmail[2856]: mBE0I1QT002856:
from=apache, size=189, class=0, nrcpts=0, msgid=
<200812140018.mBE0I1QT002856@localhost.localdomain>,
relay=apache@localhost
Really sorry this dragging on, but why do you think this is?
Is there another mailserver I can setup and use to see if its any different. I am so weary of sendmail!
|
|
|
12-13-2008, 05:34 PM
|
#15
|
Member
Registered: Sep 2008
Posts: 90
Original Poster
Rep:
|
WAIT! IT WORKS - I change the php.ini back to "/usr/lib/sendmail -t -i" and it sent. OH MY GOD!
Thank you so much for helping me and sticking with me jstephens84!! I bet I get this problem in the future and I won't know what to do - but I will be back here for sure! 
|
|
|
All times are GMT -5. The time now is 10:25 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|