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

General Tech Bugs & Fixes 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

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  to .) Do NOT set it to On as it
 prevents .htaccess files from disabling it.
  Commented following lines.
userdir.c>
    
        php_admin_flag engine Off
    

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.

profilepic.png
manpreet 2 years ago

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.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.