9

Yesterday I have changed my usergroup/user on my linux host for a group of files. Today I found out that CURL is rising a permission denied (only on browser access, works on SSH)

Couldn't send request: Failed to connect to <server_ip>: Permission denied

file is currently have 777 permissions. But I thinks it is related with user group/user.

ls -all result:

-rwxrwxrwx.  1 baknealdi psaserv    533 May 18 05:14 check.php

Listed users groups;

root:x:0:
psaserv:x:504:apache,psaftp,psaadm,nginx
psacln:x:505:

And I have read somewhere that selinux might be related with it.

sestatus result:

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   enforcing
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted

I can give any other information, but I really don't know what is related.

Bartu
  • 2,189
  • 2
  • 26
  • 50
  • I have tried selinux=permissive and selinux=disabled, If I do that, I don't get that error, instead a 403 forbidden – Bartu May 18 '13 at 10:44
  • For `403`, you probably need to look at your PHP configuration. – devnull May 18 '13 at 10:52
  • yes it is actually true ! I have applied setsebool -P httpd_can_network_connect 1 and it is all ok now ! thanks ! – Bartu May 18 '13 at 10:57

1 Answers1

21

Simply applying this line of code in the PHP configuration made it;

setsebool -P httpd_can_network_connect 1

which enabled http network connections.

Bartu
  • 2,189
  • 2
  • 26
  • 50
  • 2
    thanks for the tip! Just to clarify, this worked for me by entering it at the command line, are you saying that you can add it to `php.ini` as well? – ronan_mac Jun 20 '14 at 11:00
  • these are related sources [https://stackoverflow.com/questions/12804841/how-can-apache-be-allowed-to-send-email](https://stackoverflow.com/questions/12804841/how-can-apache-be-allowed-to-send-email) and [https://alexbilbie.com/2013/02/selinux-php-mysql/](https://alexbilbie.com/2013/02/selinux-php-mysql/) – Accountant م Jul 27 '18 at 05:16