Possible Duplicate:
Tips for Securing a LAMP Server

On a Linux based server, what are some of the best practices for securing PHP?

What functions should be disabled (ex. exec, exec_shell, system)?

marked as duplicate by Iain, Scott Pack, mailq, voretaq7, MDMarra Nov 13 '11 at 17:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Use suhosin - http://www.hardened-php.net/
  • Run PHP in cgi/fastcgi mode
  • If multiple users are using your webserver, make sure each user's php-cgi processes are spawned under a different (unprivileged) uid/gid pair from its neighbour

mod_php is not a solution because all PHP processes run with the same UID and access rights.

I use suPHP for a shared server. That way all users have their own system accounts and every PHP process is run with their own UID. --> Pro: users have restricted access and are isolated from each other. Con: less performance because it is basically a CGI model.

Stuart Herbert had a blog series about on this and other PHP setup solutions.

Not the answer you're looking for? Browse other questions tagged or ask your own question.