Apache, on its own, cannot "execute" bash scripts or commands. I think the question you're really asking is, "How can I prevent PHP from executing shell commands?".
Unfortunately the other two answers here are incorrect and provide inadequate solutions to accomplish this.
open_basedir
only affects what files can be opened by PHP, e.g. through fopen()
. You can test that shell commands can still be executed using this trivial code:
<?php
ini_set('open_basedir', '/tmp');
system('ls');
To truly restrict what shell commands can be executed by PHP you must utilize safe mode. You should be aware however that safe mode is deprecated in PHP 5.3 and will certainly be removed in a future version. Enabling safe mode restricts the access to a number of "unsafe" functions, notably exec()
, system()
, and passthru()
.
However, again you should be aware that the use of safe mode is highly discouraged.
Once safe mode is removed, you will no longer possess the means to restrict what commands can be executed by PHP.