• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Apache user changes with directive. - Why?

Sebastian

New Pleskian
When I run a simple php web page that echos out the apache user with
PHP:
echo exec('whoami');
it gives me the expected system user, e.g.
Code:
bob

When I run the same but with an alias directive in apache settings:
Code:
AliasMatch /appname(/.*)? /var/www/vhosts/domain.dev/httpdocs/apps/appname/$1
Alias /appname /var/www/vhosts/domain.dev/httpdocs/apps/appname
<Directory "/var/www/vhosts/domain.dev/httpdocs/apps/appname">
    <IfModule sapi_apache2.c>
        php_admin_flag engine on
    </IfModule>
    <IfModule mod_php7.c>
        php_admin_flag engine on
    </IfModule>
</Directory>
the user changes to
Code:
www-data
Question: Why? And how can I avoid this?
 
Last edited:
I think that explanation in this thread could be interesting for you Resolved - apache run whit customer user not whit www-data
I read this before, but it does not help here.
What UFHH01 points out there is a warning not to mess around with config files to force apache to use another user. And I can second that.
E.g. I have played around with /etc/apache2/envvars and changed the APACHE_RUN_USER and APACHE_RUN_GROUP, but that (at least) broke the Plesk log file viewer, so I had to reverse it.
 
Back
Top