PHP not rendering

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

 

Ubuntu newbie here! Really love this OS so far although I am bumping into a roadblock so apologies if the resolution to my issue is straightforward and a duplicate post.

My machine previously served PHP files successfully however after installing Composer/Laravel without any error messages, now get a HTTP ERROR 500 'This page isn't working' when attempting to serve the same files.

I have made sure my installation is current:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Confirmed apache2 service is running via service apache2 status and that PHP is functioning via:

php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'

However, when attempting to serve a PHP file via the browser, such as localhost/index.php, receive HTTP 500 error.

I have unsuccessfully attempted the resolution found here, as below:

sudo apt-get install libapache2-mod-php
sudo a2enmod php7.0
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
sudo service apache2 restart
sudo apt-get install php-fpm
sudo a2enconf php7.0-fpm
sudo apt-get install php-cgi
a2enconf php7.0-cgi

Many thanks for any help!

profilepic.png
manpreet 2 years ago

There should be an entry in your Apache error log corresponding to each HTTP 500 error. Check /var/log/apache2/error.log (I think) to see any line at the bottom corresponding to the error.

Most of the time that should indicate what the problem is.

By the way, the steps you've taken already conflict with other a bit. You can run either a threadsafe PHP, or PHP with Apache prefork MPM, or PHP as FastCGI running under php-fpm, or PHP as a CGI. But you've installed packages to do all of that, and I'm not sure what additional configuration you've tried.

Simplest solution is just to install apache2 and php, and use the mpm_prefork MPM on Apache (which Ubuntu should use by default if you install PHP) and mod_php.


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.