500 error on front-end but not on admin

I uploaded a brand-new wp install to my host. I am able to access the admin, and all its settings just fine, but I get a 500 internal error on the front-end.

I have tried solving this issue by:

  • checking .htaccess
  • checking wp-config.php
  • checking for missing core files
  • doing a permalink reset
  • checking file permissions
  • switching themes
  • disabling all plugins
  • using a default theme
  • server config (i have a vps with other sites working just fine under the same config).

What else can I check for? Could setting up wordpress under one php version and then moving it to another server under another php version cause this issue?

My .htaccess file has what you would expect.

# BEGIN WordPress
IfModule mod_rewrite.c
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
/IfModule

# END WordPress

Topic 500-internal-error Wordpress

Category Web


I have been chasing my tail for hours trying to find this problem, and it wound up being that the theme codebase from my project was developed on a PHP 5.* environment and I had it setup on PHP 7.2... and the code had the old <? opening tag (now deprecated, with no php after the question mark in the opening tags) all over the place. I had to hunt them all down and add the php so they looked like this <?php.

Try doing a search for <? with the white space after the question mark, then switch the search mode to REGEX and use <\?\n as the string to look for line returns after the question mark.

I made a YouTube about finding these little <? buggers awhile back, if it helps anyone:

PHP HOW TO FIND: "Parse error: syntax error, unexpected end of file in..." https://www.youtube.com/watch?v=dzXaQ3cttRU


It can be simple mistakes in your code too.In my case I had forgotten the php closing tag and started another opening tag in the header file


My problem had to do with file permissions. Even though it looked like the permissions were correct, the index.php in the root had the permission set to 644, instead of 664. Once I changed the permission the front-end loaded. It's a bit odd that of all files in the root, the index is the only one with the wrong permission.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.