0

I have a WordPress website on a shared hosting plan and recently I switched from PHP 5.6 to PHP 7.1. It took me a while to notice intermittent 500 internal server errors and I still haven't been able to solve this issue. Now, the interesting thing is that I managed to reproduce these errors in all 7.x (7.0, 7.1, 7.2 and 7.3) PHP versions but only on the shared server. I tried running the website locally in Wamp on these PHP versions and I was not able to reproduce the error. The error occurs completely randomly - on any page (cached or not).

I tried the following:

  • Checked/fixed permissions
  • Reinstalled WordPress core files
  • Disabled all plugins
  • Changed theme to twenty seventeen

500 errors still occur. Could this be a server problem? The hosting provider of course denies that, and according to them there is nothing in the Apache error log.

They use Apache servers and Nginx as a reverse proxy. I'm not an expert in server technology and I would like to get a bit more info on what could cause such errors before I switch to another hosting. I find it interesting that the errors do not occur in PHP 5.6.

Bob Stein
  • 16,271
  • 10
  • 88
  • 101
BlazZ
  • 19
  • 3
  • Is there something in the php logs? If not, change the logging to E_ALL in the php conf file and check after that again. 500 is a server error and there is probably something going on with the PHP. Without an error message, we cannot really help you. – Martin Dimitrov Nov 18 '19 at 09:10
  • There should be some log file on the server. If you can't find it, ask the hosting company for it. There are so many things that could cause this (ex: using deprecated features that have been removed in PHP 7, missing drivers etc). You need to find the actual error message or we won't know where to begin. – M. Eriksson Nov 18 '19 at 09:10
  • I would try setting wp debug true (`define( 'WP_DEBUG', true );`) in wp-config.php. It could help you by writing more meaningful errors instead of a simple 500. – Dajer Nov 18 '19 at 09:19
  • That are fair points guys, but the thing is that it's a shared hosting plan. Hence, I don't have access to the Apache error log and the hosting company insists that there is nothing in the error log. I did enable display errors in php.ini but nothing gets thrown out. Maybe hosting is overriding this setting? – BlazZ Nov 18 '19 at 09:20
  • Dajer, WordPress debugging is enabled and working - that I tested by making a simple syntax error. Nevertheless, these errors are not written in the error log. – BlazZ Nov 18 '19 at 09:21
  • I don't know what the hoster will be, but as a general rule the hosters allow you to access the logs in some apache and php format. The 500 errors are very typical in scenarios in which php is executed with php-fpm, and those errors are not usually logged by Apache or Nginx but by PHP-FPM itself. But the maximum time is ... logs, logs, logs. SIn that is an adventure to help you or a fallacy – abkrim Nov 18 '19 at 10:21
  • Yeah I know that. I'll be migrating to another host. I mean if the hosting company can't provide me with some kind of logs it's really impossible for me to fix anything. – BlazZ Nov 18 '19 at 16:19
  • I'm having the same problem right now. It's been 20 days trying to solve the problem with no success. Heve you found the origin of the problem? – Peristilo peris Mar 07 '23 at 18:21

0 Answers0