Forum Moderators: coopster
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;
?>
but doesn't do anything
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.