Forum Moderators: coopster

Message Too Old, No Replies

exec and system commands blocked by host

website host blocking exec and system commands but why?

         

fabricator

2:08 pm on Aug 12, 2006 (gmt 0)

10+ Year Member



I've got this code, its the simpliest example I could make. It works perfectly on my windows xp/apache/php box, but doesn't do anything on a commercial website host. The actual code should use gzip to compress a folder but that doesn't work either.

Anyone know the reason why they would be blocking these commands? I suspect the problems with commonly used php apps like phpBB to be the real reason.


<?
exec("ping 127.0.0.1 > test.txt") or die();
// get contents of a file into a string
$filename = "test.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));

fclose ($fd);

echo $contents;

?>

dreamcatcher

9:01 am on Aug 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi fabricator,

Did you get this sorted out?

dc

Romeo

10:52 am on Aug 17, 2006 (gmt 0)

10+ Year Member



but doesn't do anything

... not even throwing a message to the error_log?

Hard to tell without substantial information.
If it is blocked by the hoster, it is mostly due to security aspects, but in the end only the hoster will know why he did what.

But are you sure 'exec' is blocked at all?
Several possibilities:
... perhaps the external command should be called with "/path/to/ping", in case the path may not be known in the webserver's environment
... perhaps ping is not installed at the server
... perhaps ping is installed, but access is rwx------ to prevent execution by the webserver
... perhaps exec is disabled in the PHP-config due to security concerns
... perhaps something else ...

The error_log could tell you more.

Kind regards,
R.