[Solved] SocketException Permission denied - CakePHP

CakePHP is a PHP development framework used in many projects. CakePHP supports sending mail via built in mail functions of PHP, smtp server. One may face following error message while sending mail:

SocketException Permission denied - CakePHP

The issue is related to the SELinux policy of the OS. SELinux forbid PHP/Apache to make network connections.
In this case, one has to make an exception to allow Apache/PHP to make network.

Solution:

1) First make sure that SELinux is in enforcing mode

setenforce 1
sestatus | grep -i mode

Output:

Current mode:           enforcing
Mode from config file:  permissive

2) Execute following command to allow connection:

setsebool -P httpd_can_network_connect=1

The command will take sometime to complete execution. This setting will be permanently applied on the server.

3) Verify using following command:

getsebool httpd_can_network_connect

Output:

httpd_can_network_connect --> on

That's All!

CakePHP is a PHP development framework used in many projects. CakePHP supports sending mail via built in mail functions of PHP, smtp server. One may face following error message while sending mail: SocketException Permission denied - CakePHP The issue is related to the SELinux policy of the OS. SELinux forbid PHP/Apache to make network connections. In this case, one has to make an exception to allow Apache/PHP to make network. Solution: 1) First make sure that SELinux is in enforcing mode setenforce 1 sestatus | grep -i mode Output: Current mode: enforcing Mode from config file: permissive 2) Execute following…

Review Overview

5

Superb

User Rating: Be the first one !
Share on Facebook3
Share on Google+1Tweet about this on TwitterShare on StumbleUpon1Share on LinkedIn1Share on Tumblr0Digg thisPin on Pinterest0Share on Reddit0Email this to someonePrint this page

About Abhijit Sandhan

Abhijit Sandhan
Loves Linux, Blogging, Traveling, Hiking and sharing knowledge!

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA