If you don't receive any content with file_get_contents()
and curl
, like this error below:
file_get_contents('url'): failed to open stream: Permission denied
-
Be sure you have
allow_url_fopen=On
in yourphp.ini
file. (If someone doesn't know where your php.ini file is, quick check with phpinfo() could get you everything. -
Check status of SELinux:
sudo sestatus
If the status is enabled , then you can check whether the boolean flags httpd_can_network_connect and httpd_unified are enabled, set to 1:
sudo sestatus -b | grep httpd_can_network_connect and sudo sestatus -b | grep httpd_unified
If they're off, run this command to set them on:
sudo setsebool -P httpd_can_network_connect 1 sudo setsebool -P httpd_unified 1
Resolved by running:
sudo setsebool -P httpd_can_network_connect 1
sudo setsebool -P httpd_unified 1