PHP Unable to send email from web application .. (but commandline works)

This issue seems to have popped up a couple times over the past couple weeks so I figure I would capture the resolution here in the event someone stumbles onto this post and it's able to help them. Security is rarely convenient and this is an example of that.

Symptom:

CentOS machine running current on patches and running a current version of PHP, let's say PHP 5.3 or higher. PHP script is able to sent email from the command line, but when trying to send an email with PHP through the web browser it fails. Actually it doesn't "fail" it just doesn't seem to ever send.

Resolution:

SELinux is running on the machine and is preventing the Apache process to send out emails. There are a couple approaches you can take for this. To quickly test and confirm that the problem is in fact SELinux, and not something else, you can temporarily disable SELinux.

  • First verify SELinux is running with the command (as root) getenforce
  • Next, if SELinux is running you can disable with the command, again as root, setenforce Permissive

 

SELinux with be disable until you reboot the machine or enable it with setenforce Enforcing. You can permanently disable SELinux is you so desire editing the file /etc/sysconfig/selinux and changing the setting SELINUX=

Test your PHP Mail functionality now from the web application. If it works then you need to have SELinux allow the apache process to send emails. In order to do this, run the commands

  • setsebool -P httpd_can_sendmail 1
  • setsebool -P httpd_can_network_connect 1

 

You should now be able to re-enable SELinux and successfully send emails from your application in the browser.

PHP Unable to send email from web application .. (but commandline works)

This issue seems to have popped up a couple times over the past couple weeks so I figure I would capture the resolution here in the event someone stumbles onto this post and it’s able to help them. Security is rarely convenient and this is an example of…

This issue seems to have popped up a couple times over the past couple weeks so I figure I would capture the resolution here in the event someone stumbles onto this post and it's able to help them....

Keeping Vendor Meetings Productive

I spent a good amount of my professional life in meetings. Tons of meetings. When I worked for a Fortune 500 company, I started to think they were paying me just to fill a chair in a conference room. I started jotting down notes on meetings and how to best run them. I recently came across those notes and figured I would just throw them up here in the event they happen to be useful to someone else. Full disclosure, I am a well documented anti-meeting guy. I am not a fan of them and feel that more times than not, they are a waste of time and money. However they are a necessary evil, especially when working for a large organization or with large teams, and if handled correctly can actually become productive. One area where meetings can't be avoided and have a high requirement to be well organized is when meeting with new vendors.

Meeting with a new, or potential new, vendor can be like having to talk to someone you don't know at a friends party. You know you have the friend in common but really don't know much more about one another and yet you need to try and have a conversation with them. I've found following a couple of rules make meetings with vendors a lot more efficient and productive.
Continue reading Keeping Vendor Meetings Productive

Since LEGO made movies are all the rage right now, why not make a LEGO movie explain the philosophies…

Since LEGO made movies are all the rage right now, why not make a LEGO movie explain the philosophies behind Open Source. Seems to make sense. 

This is actually not a bad introduction to Open Source for those of us that struggle making it easy and non-technical to understand. 

My SDPHP Composer Presentation

A little while back I did a lightning talk at one of our SDPHP MeetUps on Composer. Composer is a fantastic tool and one that will change the way you approach PHP development. Using and managing external packages on a per project level has never been so easy in the PHP world.

I kept forgetting to publish my slides so for what it's worth, here they are.

 

The new PHP – Programming – O’Reilly Media

If your organization has written off PHP from being a possible solution to its development needs, you may want to rethink that decision. PHP is making a strong comeback and with developers who have years of experience under their belt, a language that has matured with the Internet it helps run, and now new features, stronger communities, and interoperability high on everyone's priority list, PHP is once again a great solution for any development need. 

The programming language many love to hate is experiencing a renaissance. This is not your parents' PHP. The new PHP is a more mature language with community standards,...

Weather cleared up and was beautiful. Ton of people in good spirit here at Chelsea’s Run #t  

Weather cleared up and was beautiful. Ton of people in good spirit here at Chelsea's Run #t  

Weather cleared up and people showed up for Chelsea’s Run #t #chelseasrun

Weather cleared up and people showed up for Chelsea's Run #t #chelseasrun

20140301_072034.jpg

Added photos to SCALE 12x – Southern California Linux Expo.

Added photos to SCALE 12x - Southern California Linux Expo.

Added photos to SCALE 12x – Southern California Linux Expo.

Added photos to SCALE 12x - Southern California Linux Expo.

Hanging out at #scale12x in Los Angeles today. Conference gets bigger and bigger every year.

Hanging out at #scale12x in Los Angeles today. Conference gets bigger and bigger every year. 

#SDPHP  had a last minute change of venue that landed us at #prefabsd which is a new co-working location…

#SDPHP  had a last minute change of venue that landed us at #prefabsd which is a new co-working location in downtown San Diego. Nice space and you can't bet the location. #t  

20140212_203308.jpg

Ewww, You Use PHP? | MailChimp Email Marketing Blog

Nice simple post without climbing up on the soapbox too much 🙂 

Lately here at MailChimp we’ve been trying to bring in more developers to help us keep the innovation coming fast…