When I open any website here on my Ubuntu 17.10 PC, they suddenly just give garbage, as though something has broken but I am not sure what. I thought that perhaps PHP wasn't running but when I open in the browser, it's showing the same thing rather than showing Apache2's Welcome page. This is a relatively fresh installation that was working perfectly until yesterday when sites started timing out, then the current problems. I'm running Apache2 version 2.4.27 and PHP version 7.1.11.

The "garbage" appears to be bits and pieces of code rather than the page's full code:

$CaptionText" : ""; if (ImageExt($ImageName) != "pdf") : $PageImage .= $ImageCaption; $PageImage .= "
"; elseif ($Category == 6) : $PageImage .= "

"; else: $LinkTitle = explode(".", $CaptionText); $TitleText = $LinkTitle[0]; $CaptionText = str_replace("$TitleText.", "", $CaptionText); $PageImage .= "

"; endif; endforeach; $PageText .= $PageImage; endif; include $_SERVER ['DOCUMENT_ROOT'] . "/internals/includes/pageheader.php";?>
  • Elaborate on garbage. – ImprobabilityCast Mar 1 '18 at 2:32
  • have you tried this stackoverflow.com/questions/12142172/… – Aravind Mar 1 '18 at 7:27
  • Yes, I saw that and just about every other posting here and elsewhere but nothing quite matches this issue or fixes it. Last night I tried uninstalling and reinstalling libapache2-mod-php but no joy there either. By the way, I'm running Apache2 2.4.27 and PHP version 7.1.11. – DonP Mar 1 '18 at 16:05
  • Did you fix the problem of sites timing out, or did that problem fix itself and start garbage output problem? – ImprobabilityCast Mar 2 '18 at 5:05
  • No, unfortunately still timing out. – DonP Mar 3 '18 at 6:56
sudo apt install --reinstall apache2 php libapache2-mod-php
sudo a2enmod php7.1
sudo apache2 reload
sudo apache2 restart

Check installed php version, if it different from 7.1 then modify 2nd line

  • I had already tried that and did it again as the suggestion but still isn't running. – DonP Mar 1 '18 at 17:07
  • try install libapache2-mod-php7.1 – Pharma Mar 1 '18 at 17:27
  • Resorting to Webmin I was able to re-enable PHP7.1 support for Apache2 and now the test phpinfo() page is showing as it should but the Apache Welcome Page and all Web sites simply time-out. – DonP Mar 1 '18 at 18:45

Just updated my linux box and got the same problem. Fixed it by running

ln -s mods-available/php7.1.conf mods-enabled/php7.1.conf
ln -s mods-available/php7.1.load mods-enabled/php7.1.load
apache2ctl restart

in /etc/apache2. The newly created symlinks enabled the PHP module for Apache. If the symlinks are already in mods-enabled, then the problem is elsewhere and this won't help.

  • Not sure what you are suggesting to do but will take a look. The odd thing here is that this was a fresh install of the entire OS, not an update, and it was working fine. Right in the middle of some work, the sites started to time out and are still doing so. I will be leaving the state next week and won't be back for several months and am hoping to have it sorted out by then! – DonP Mar 2 '18 at 3:55
  • @DonP Updated answer to clarify. – ImprobabilityCast Mar 2 '18 at 4:49
  • Thank you for the clarification. Unfortunately the first and second lines give errors (showing only the first but the other is the same): ln: failed to create symbolic link 'mods-enabled/php7.1.conf': File exists – DonP Mar 2 '18 at 19:32
  • @DonP Yup, the symlinks are already there, so this won't fix your problem. This question has me stumped, but I will certainly check back if I think of anything. – ImprobabilityCast Mar 3 '18 at 20:05

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.