1

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.

5
  • What's the actual problem? <?php echo "Foo bar" ?> works, but phpinfo() does not?
    – vidarlo
    Aug 15 '18 at 19:06
  • Trying to load a file called test.php containing <?php echo "Foo bar" will not display via Firefox, but command line php < test.php will display correctly. Aug 15 '18 at 19:09
  • Same for phpinfo.php. Will not display if accessed via browser, but php < phpinfo.php will provide complete textual output. Aug 15 '18 at 19:10
  • Where is the script you're trying to call via the browser located?
    – vidarlo
    Aug 15 '18 at 19:13
  • /home/*/public_html/phpinfo.php. I might add that file:////var/www/html/phpinfo.php access by Firefox wants to download the file. Aug 15 '18 at 19:17
0

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.

1
0

I encountered a similar problem with php files not being executed after an upgrade from Ubuntu 18.10 to 19.10 and php 7.3. It turns out that this question was my answer. My Web root was in /home/xyz/public_html. The solution was to comment the block <IfModule mod_userdir.c> ... </IfModule>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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