Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

Aquavit

(488 posts)
Wed Mar 19, 2014, 11:09 PM Mar 2014

Some kind of MAMP/sendmail/PHP issue

I'm trying to test a website that I am developing using MAMP, PHP 5.3, and sendmail on Mac OS X 10.5.8. My php script is using $_SERVER['PHP_SELF'] to collect form data via POST. When I submit test input, the page reloads as expected, but it doesn't send the form to my email as expected.

I haven't done anything to the default httpd.conf that came with MAMP, and I've only uncommented line 566 (the UNIX sendmail config line) in php.ini. I manually launched sendmail via console, and it seems to have started without issue.

If I've gotten everything configured correctly in MAMP, and my sendmail is working correctly, and there's not a bug in my php script, I should be able to send my form data to email right? I'm not extremely proficient with php, but I'm pretty sure the script I've written should be good to go. Is there anyone with more experience with this than me who can help me get this sorted out?

3 replies = new reply since forum marked as read
Highlight: NoneDon't highlight anything 5 newestHighlight 5 most recent replies
Some kind of MAMP/sendmail/PHP issue (Original Post) Aquavit Mar 2014 OP
Make sure ownership and php.ini file permissions are correct. Run debug on php script to see where Drew Richards Mar 2014 #1
Update Aquavit Mar 2014 #2
Yep youre on right track and posrfix has good install docs...i have just one more suggestion Drew Richards Mar 2014 #3

Drew Richards

(1,558 posts)
1. Make sure ownership and php.ini file permissions are correct. Run debug on php script to see where
Wed Mar 19, 2014, 11:33 PM
Mar 2014

And if it is doing a call...permissions on script default probably on 655 needs to be 755

Make SURE to run sendmail as a protected user account NOT as root or you have left big security hole due to php script attacks....


I would recommend you rethink your design...sendmail while easy to setup and run has a lot of insecurities....reconsider same design but use postfix.

Aquavit

(488 posts)
2. Update
Thu Mar 20, 2014, 05:06 PM
Mar 2014

You were spot on regarding the permissions on the script. I had to re-set them to 755.

I'm using Aptana to develop the script, and it's got a built-in PHP debugger. The good news is that it doesn't show any errors, so I think I'm ok on the script side of things.

I'm trying to move to postfix from sendmail. I think all I need to do in php.ini to make the move is change the path from /usr/sbin/sendmail to /usr/postfix right? And from there, I need to configure postfix to allow me to send mail from localhost. Not quite sure how to do that just yet, but I'm sure there is documentation that I just haven't found yet.

Drew Richards

(1,558 posts)
3. Yep youre on right track and posrfix has good install docs...i have just one more suggestion
Thu Mar 20, 2014, 07:14 PM
Mar 2014

Before you make final install go read about CHROOT and see if its something you want to do...
In a nut shell...building mail using chroot basiclly segments mail and their directories to a secure permission locked directory structure...securing the rest of you server and applications away from many of the piss ant script kiddies exploits...its a bit more work but can save you from having to reformat and restore from a nasty root hack.

Drew.

Latest Discussions»Retired Forums»Website, DB, & Software Developers»Some kind of MAMP/sendmai...