Change the user and group that PHP executes as

Discussion in 'Installation/Configuration' started by Shella, Mar 5, 2009.

  1. Shella

    Shella New Member

    Hi all, i'm hardening a web server with apache.
    PhpsecInfo suggest me to do this:

    "Change the user and group that PHP executes as. If you're using the Apache module, you'll need to change what user Apache runs as with the User and Group directives"

    How can I do it? On my server i got just root user and root group.
    I can create new users and new group but how can I tell to system to use that user to execute PHP?
    Thanks a lot.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    If you're using mod_php, you must change the User and Group directives in the apache configuration.

    To create users and groups, take a look at
    Code:
    man groupadd
    man useradd
     
  3. Shella

    Shella New Member

    Thanks Falko, the problem is that i don't know how to change the User and Group directives in the apache configuration. I know how to add users and group but where I can change? apache2.conf? Thanks.
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Depends on your distribution. For Debian/Ubuntu, it's /etc/apache2/apache2.conf, and for Fedora/CentOS, it's /etc/httpd/conf/httpd.conf.
     

Share This Page