Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Apache Web Server, is there a way to set user and group differently between virtual hosts? I want to run PHP script with the owner's permission (in mod_php).

share|improve this question
up vote 1 down vote accepted

Use one of the following:

  • suPHP - run PHP as a user
  • suExec - run CGI as a user (if you run PHP as CGI)

These will run PHP as the user you specify in your VirtualHosts configuration.

Chances are your linux distro will already have these available in a repository somewhere.


share|improve this answer

You can use apache2-mpm-itk which allows to customize Apache user and group used for each virtual host.

apt-get install apache2-mpm-itk

nano /etc/apache2/sites-available/

<VirtualHost *:80>
    DocumentRoot /home/myuser/
    Options -Indexes
    AssignUserID myuser mygroup

See Create and set up an Apache virtual host for more details.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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