not necessarily a selinux problem
could be caused by,
1. wrong configuration in config.php
2. dns problem
3. network connection problem
the last thing to think about is selinux if it's indeed turned on.
to call a shell command from a php script, use shell_exec(string $cmd) or backticks.
good luck.