0

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!

2 Answers 2

0

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.

6
  • Thanks for your reply and tips, Thomas! I really appreciate it! I am guilty of trying things which conflict, due of course to not understanding fully. I am endeavouring to get to a more default configuration.
    – HatHead
    Jan 23, 2018 at 3:41
  • Thanks for your reply and tips, Thomas! I really appreciate it! I am certainly guilty of trying things which conflict, due to not understanding fully and am endeavouring to get back to a more default configuration, which I have likely compromised. Simple solution-wise, Apache2 & PHP are both installed and attempts to reinstall them report that they are up-to-date. I am not 100% on how to use the mpm_preform MPM on Apache and mod_php but am looking it up.
    – HatHead
    Jan 23, 2018 at 3:59
  • Also, thanks for the error log path! Here is an error: PHP Fatal error: require(): Failed opening required '/var/www/html/tatum/public/../vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/html/tatum/public/index.php on line 24
    – HatHead
    Jan 23, 2018 at 4:00
  • Sorry preform was a typo, I meant prefork. That's the "traditional" way to run PHP in Apache. Jan 23, 2018 at 4:02
  • "preform" was my typo - you got it right! :-)
    – HatHead
    Jan 23, 2018 at 4:05
0

Just closing this off - I resolved this issue by purging and reinstalling Apache2 and PHP. The real issue here is my poor networking skillz!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .