crowhill
crowhill

Reputation: 2558

PHP on Centos can't exec("ping google.com"); but can exec("whoami");

This is on a Centos 6 machine with a pretty standard install.

I run

exec("whoami");

and I get

apache

I run

exec("ping google.com");

and I get nothing at all. No result.

I run the exact same code on an Ubuntu machine and everything works.

Now, I don't necesarily need a solution to the problem (though that would be nice) but I can't even figure out how to go about debugging. Is there a way to log the raw output of the command? All I can get so far is a return value of "2" which is "other error."

There are a number of questions similar to this one on Stackexchange, but most of them have to do with file permissions, which shouldn't be an issue here.

Upvotes: 0

Views: 290

Answers (1)

crowhill
crowhill

Reputation: 2558

Nevermind. It's SELinux. It's always SELinux. Now to figure out how to grant apache permission to use ping...

Upvotes: 2

Related Questions