0

After upgrading my OS I can't access the main page of my personel little local website anymore.

Last month I upgraded my Debian Squeeze to Jessie. Before upgrading I had copied all php files, image folders and the mysql database to an external hard disk. After the upgrade I put everything back. At first the problem was that I didn't have permission to access the main page even though I own every file and folder that's connected to this site. A little chmod a+rx seemingly fixed this but when I go to the main page, all I get is a blank screen. I checked the website's folder and found that a number of files have a second version ending in .php~. I never noticed this before and I'm sure I didn't create those files myself. (Actually I found a reference in an old thread somewhere to some editors creating automatic backups with this extension. Guess that's what happened here.) These extra files only show up in a terminal, not in a file manager.

So there is a file named hoofdmenu.php (main page) and one named hoofdmenu.php~. Hoofdmenu.php is my starting page and it only shows a blank screen. In Firebug all you see is:

<html>
<head></head>
<body></body>
</html>

However, if I go to hoofdmenu.php~ I get my webpage (minus a function I defined but that's a minor problem). I can also navigate from the main page to other pages and between other pages. Only when I go back to the main page (every page has a return home button) I get the same old blank screen.

The only difference between both files is the indentation of a few blocks of code. Given that hoofdmenu.php~ works I tried copying this file to hoofdmenu.php but then again I get the empty screen. Can anyone tell me what I'm missing here?

Thanks in advance.

AD7six
  • 63,116
  • 12
  • 91
  • 123
guy13
  • 27
  • 7
  • The ~ version is usually a temporary file created by your editor. The white screen is probably a syntax error. – Farkie May 05 '16 at 21:59
  • Have you looked in your error logs? There are any number of reasons that an OS upgrade could cause this. Perhaps your version of PHP was upgraded and broke your application. Perhaps some library or dependency that your application depends on was removed and your application is hitting some sort of fatal error when trying to use that dependency, As it stands, the question is much too broad to answer. The weird file names are probably not part of the problem, but probably an artifact of your IDE. You should only care about the failure on the properly named scripts first. – Mike Brant May 05 '16 at 21:59
  • As such accessing *.php~ doesn't run PHP interpreter and the page you see is a content of the file displayed as plaintext (i'm pretty sure the HTML tags are still interpreted by the browser correctly, that's why you see navigation, etc.). It seems that the upgrade broke your PHP code in the main file and you should turn on debugging directives to identify the weak spot - check this one http://stackoverflow.com/a/845025 and let me know if you get any errors – David Jirman May 05 '16 at 22:04
  • @David Jirman: Checking /var/log/apache2/error.log pointed to an unexpected end of file. I don't consciously use short tags but I went looking for them just to be sure and found a stray semicolon (as in – guy13 May 06 '16 at 09:40
  • @Mike Brant: Same goes for your comments. – guy13 May 06 '16 at 09:43

1 Answers1

1

Checking /var/log/apache2/error.log pointed to an unexpected end of file. I don't consciously use short tags but I went looking for them just to be sure and found a stray semicolon:

<?php;

Removing said semicolon solved the entire problem including the unresponsive function. Apparently some previous version of something didn't mind (last alteration of the file was February 19 so it worked at least six weeks with the semicolon in place). Everything is now running again as it's supposed to.

guy13
  • 27
  • 7