Php – How to prevent PHP from executing shell commands

apache-2.2bashPHPSecurity

how to prevent apache from executing bash scripts?? That any php script can't execute command in bash (for example command that will add links to my php and html files). Is there a way to do that??

EDIT: I had on my mind any bash command not only .sh files

Best Answer

You may want to look at the open_basedir config parameter. Not really an answer to your question, but it is related. It's a good idea to set a basedir per site like "/var/www/site:/usr/share/php:/tmp". (The /usr/share/php can be different on each machine).

To really answer your question: you can also put this in a .htaccess:

<Files *.sh>
  ForceType 'text/plain; charset=UTF-8'
</Files>