Ubuntu – PHP script not executing on Apache server. U-18.4 PHP 7.2 Localhost

Apache2localhostPHPserver

My Apache is running and displays the Default Page. I can redirect a PHP file into php and the echo command displays properly.
I've already researched previous versions of Ubuntu and can't find any solution.

a2query -m php7.2  -> Enabled by maintainer script

In /etc/apache2/mods-avaliable/php7.2.conf

These lines have been commented.
 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.
  Commented following lines.
<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_flag engine Off
    </Directory>
</IfModule>

The classic phpinfo.php processes but no output is provided by Apache. i.e. php < phpinfo.php lists all the information.

I believe that there is a setting required and/or a value not set.
This resulted after upgrading from Ubuntu 15.04 to Ubuntu 18.04.
Any help would be appreciated.

Best Answer

In file /etc/apache2/envvars the user and group were not correct. changed export APACHE_RUN_USER=www-data to myname and changed export APACHE_RUN_GROUP=www-data to myname

Other changes were made to the apache configuration file to get phpmyadmin to work, but that's another story.