Debian 8.5 PHP7 upgrade, Apache now runs as www-data instead of virtual server owner

Followed everything from this thread: https://www.virtualmin.com/node/39270 But still no luck, Apache 2 runs as www-data and gives me loads of troubles because of that.

My machine is a Debian 8.5 fresh install, Virtualmin the latest and both php5 and php7 installed.

  • If you go into System Settings -> Re-Check Config, does it detect any PHP-related errors?
Apache is installed.

The following PHP versions are available : 5.6.24 (/usr/bin/php5-cgi), 7.0.10 (/usr/bin/php-cgi7.0)

Apache is configured to host SSL websites.

**.. your system is ready for use by Virtualmin.**

find /etc/apache2/mods-enabled | xargs grep -i sethandler

find /etc/apache2/mods-enabled | xargs grep -i sethandler
grep: /etc/apache2/mods-enabled: Is a directory
/etc/apache2/mods-enabled/php5.conf:#    SetHandler application/x-httpd-php
/etc/apache2/mods-enabled/php5.conf:#    SetHandler application/x-httpd-php-source
/etc/apache2/mods-enabled/proxy_balancer.conf:  #          SetHandler balancer-manager
/etc/apache2/mods-enabled/php5.conf.save:#    SetHandler application/x-httpd-php
/etc/apache2/mods-enabled/php5.conf.save:#    SetHandler application/x-httpd-php-source
/etc/apache2/mods-enabled/status.conf:          SetHandler server-status

Even after commenting out the php5 handlers I still get the same user , www-data. Note that I do not have a php7 handler in there.

  GNU nano 2.2.6                                 File: /etc/apache2/mods-enabled/php5.conf

#<FilesMatch ".+\.ph(p[345]?|t|tml)$">
#    SetHandler application/x-httpd-php
#</FilesMatch>
<FilesMatch ".+\.phps$">
#    SetHandler application/x-httpd-php-source
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
#<FilesMatch "^\.ph(p[345]?|t|tml|ps)$">
#    Require all denied
#</FilesMatch>

# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_flag engine Off
    </Directory>
</IfModule>

Restarting php-fpm and apache2

Environment
Variable Value
USER www-data
HOME /var/www

I even removed php5.6 so php7 is the only version on the system, still same results. Anybody know how to fix this? I lover php7, really fast.

Status: 
Active

Comments

Howdy -- you may want to take a peek at this here to see if any of this helps:

https://www.virtualmin.com/documentation/system/faq#toc-why-does-php--pr...

It does look like you have all the SetHandler lines commented out. Chances are that there's something new in the Apache config file for the new PHP version that's causing a problem... they key would be determining what that is.

It looks like you're using Virtualmin GPL there though... if you're using Virtualmin GPL, you'd actually want to use the Forums for support. We monitor the Forums, along with lots of wonderful folks in the community.

When posting there, let us know what output you receive if you run "ls /etc/apache2/mods-enabled/".

thanks Andrey! Very nice of you to help.

Output of ls -la /etc/apache2/mods-enabled/

~# ls -la  /etc/apache2/mods-enabled/
total 8
drwxr-xr-x 2 root root 4096 Aug 25 11:27 .
drwxr-xr-x 9 root root 4096 Aug 25 13:10 ..
lrwxrwxrwx 1 root root   36 Aug 21 11:50 access_compat.load -> ../mods-available/access_compat.load
lrwxrwxrwx 1 root root   30 Aug 21 11:52 actions.conf -> ../mods-available/actions.conf
lrwxrwxrwx 1 root root   30 Aug 21 11:52 actions.load -> ../mods-available/actions.load
lrwxrwxrwx 1 root root   28 Aug 21 11:50 alias.conf -> ../mods-available/alias.conf
lrwxrwxrwx 1 root root   28 Aug 21 11:50 alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root   33 Aug 21 11:50 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root   44 Aug 21 11:52 auth_digest.load -> /etc/apache2/mods-available/auth_digest.load
lrwxrwxrwx 1 root root   33 Aug 21 11:50 authn_core.load -> ../mods-available/authn_core.load
lrwxrwxrwx 1 root root   33 Aug 21 11:50 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root   33 Aug 21 11:50 authz_core.load -> ../mods-available/authz_core.load
lrwxrwxrwx 1 root root   33 Aug 21 11:50 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root   32 Aug 21 11:50 authz_svn.load -> ../mods-available/authz_svn.load
lrwxrwxrwx 1 root root   33 Aug 21 11:50 authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root   32 Aug 21 11:50 autoindex.conf -> ../mods-available/autoindex.conf
lrwxrwxrwx 1 root root   32 Aug 21 11:50 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root   26 Aug 21 11:52 cgi.load -> ../mods-available/cgi.load
lrwxrwxrwx 1 root root   39 Aug 21 11:52 dav_fs.conf -> /etc/apache2/mods-available/dav_fs.conf
lrwxrwxrwx 1 root root   39 Aug 21 11:52 dav_fs.load -> /etc/apache2/mods-available/dav_fs.load
lrwxrwxrwx 1 root root   26 Aug 21 11:50 dav.load -> ../mods-available/dav.load
lrwxrwxrwx 1 root root   30 Aug 21 11:50 dav_svn.conf -> ../mods-available/dav_svn.conf
lrwxrwxrwx 1 root root   30 Aug 21 11:50 dav_svn.load -> ../mods-available/dav_svn.load
lrwxrwxrwx 1 root root   30 Aug 21 11:50 deflate.conf -> ../mods-available/deflate.conf
lrwxrwxrwx 1 root root   30 Aug 21 11:50 deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root   26 Aug 21 11:50 dir.conf -> ../mods-available/dir.conf
lrwxrwxrwx 1 root root   26 Aug 21 11:50 dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root   26 Aug 21 11:50 env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root   28 Aug 21 11:50 fcgid.conf -> ../mods-available/fcgid.conf
lrwxrwxrwx 1 root root   28 Aug 21 11:50 fcgid.load -> ../mods-available/fcgid.load
lrwxrwxrwx 1 root root   29 Aug 21 11:50 filter.load -> ../mods-available/filter.load
lrwxrwxrwx 1 root root   27 Aug 21 11:50 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx 1 root root   27 Aug 21 11:50 mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root   34 Aug 21 11:50 mpm_prefork.conf -> ../mods-available/mpm_prefork.conf
lrwxrwxrwx 1 root root   34 Aug 21 11:50 mpm_prefork.load -> ../mods-available/mpm_prefork.load
lrwxrwxrwx 1 root root   34 Aug 21 11:50 negotiation.conf -> ../mods-available/negotiation.conf
lrwxrwxrwx 1 root root   34 Aug 21 11:50 negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root   47 Aug 21 11:52 proxy_balancer.conf -> /etc/apache2/mods-available/proxy_balancer.conf
lrwxrwxrwx 1 root root   47 Aug 21 11:52 proxy_balancer.load -> /etc/apache2/mods-available/proxy_balancer.load
lrwxrwxrwx 1 root root   38 Aug 21 11:52 proxy.conf -> /etc/apache2/mods-available/proxy.conf
lrwxrwxrwx 1 root root   46 Aug 21 11:52 proxy_connect.load -> /etc/apache2/mods-available/proxy_connect.load
lrwxrwxrwx 1 root root   33 Aug 21 12:48 proxy_fcgi.load -> ../mods-available/proxy_fcgi.load
lrwxrwxrwx 1 root root   43 Aug 21 11:52 proxy_http.load -> /etc/apache2/mods-available/proxy_http.load
lrwxrwxrwx 1 root root   38 Aug 21 11:52 proxy.load -> /etc/apache2/mods-available/proxy.load
lrwxrwxrwx 1 root root   40 Aug 21 11:52 rewrite.load -> /etc/apache2/mods-available/rewrite.load
lrwxrwxrwx 1 root root   31 Aug 21 11:50 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx 1 root root   31 Aug 21 11:50 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root   44 Aug 21 11:52 slotmem_shm.load -> /etc/apache2/mods-available/slotmem_shm.load
lrwxrwxrwx 1 root root   36 Aug 21 11:52 socache_shmcb.load -> ../mods-available/socache_shmcb.load
lrwxrwxrwx 1 root root   26 Aug 21 11:52 ssl.conf -> ../mods-available/ssl.conf
lrwxrwxrwx 1 root root   26 Aug 21 11:52 ssl.load -> ../mods-available/ssl.load
lrwxrwxrwx 1 root root   29 Aug 21 11:50 status.conf -> ../mods-available/status.conf
lrwxrwxrwx 1 root root   29 Aug 21 11:50 status.load -> ../mods-available/status.load
lrwxrwxrwx 1 root root   29 Aug 21 11:52 suexec.load -> ../mods-available/suexec.load

I fgrepped all the files, there is a 'SetHandler' in there.

:/etc/apache2/mods-enabled# fgrep 'SetHandler' *
proxy_balancer.conf:    #          SetHandler balancer-manager
status.conf:            SetHandler server-status

Content of servers-status:

  GNU nano 2.2.6                                                 File: status.conf

<IfModule mod_status.c>
        # Allow server status reports generated by mod_status,
        # with the URL of http://servername/server-status
        # Uncomment and change the "192.0.2.0/24" to allow access from other hosts.

        <Location /server-status>
                SetHandler server-status
                Require local
                #Require ip 192.0.2.0/24
        </Location>

        # Keep track of extended status information for each request
        ExtendedStatus On

        # Determine if mod_status displays the first 63 characters of a request or
        # the last 63, assuming the request itself is greater than 63 chars.
        # Default: Off
        #SeeRequestTail On


        <IfModule mod_proxy.c>
                # Show Proxy LoadBalancer status in mod_status
                ProxyStatus On
        </IfModule>


</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

(I did not know about the gpl v. paid version support. I apologize and will in the future use the forums, thanks for letting me know).

That's good info you have above there -- my suggestion would be to open a new Forum thread, and include that as part of the new thread. Thanks!