Jump to content

Loads of 500 errors


MarkE
 Share

Recommended Posts

One of my sites has just crashed and gives server 500 errors. Looking at the logs, the cause is multiple fatal errors of the type:

Fatal Error:     Uncaught Error: Class '\ProcessRedirects' not found

Inspecting the code, it seems like the

namespace ProcessWire;

statement is missing in many of the modules and this seems to be causing the error. I'm inserting the statement as I get each error and each time I get a new instance. The odd thing is that the code has not been changed recently (apart from one Hanna code which was working yesterday). The problem only started this afternoon. Is my diagnosis correct and, if so, what might have caused this to suddenly start giving fatal errors.

Link to comment
Share on other sites

PW v 3.0.123

I haven't upgraded since the original installation

PHP 7.2

I have raised a query with the hosting service

Adding namespaces seems to be fixing it (at least partially - still more to do), but I've no idea why it was suddenly a problem (and a lot of modules do not have namespace statements.

Link to comment
Share on other sites

That's weird.

Clear all cached files - website cache and the compiled files.

There must have been a change somewhere, maybe in a main settings of whatever.

As @flydev says... enable that option and while you are doing this check the modified date of your files and folders within your web root.

Link to comment
Share on other sites

7 minutes ago, flydev said:

set debug to true then tell us the file which trigger this error

It was set to true - that's how I was able to identify files with the missing namespace statement. Adding 

namespace ProcessWire;

seems to fix the errors, but why is it suddenly a problem??? I have changed no settings. In fact I hadn't touched the site since it was working fine yesterday - a user then alerted me to the problem this afternoon. The hosting service say they haven't changed anything either. The .htaccess is unchanged as is the php config. ?

Link to comment
Share on other sites

Mostly a guess, but similar issues have occurred when FileCompiler cache is empty, and then it gets populated by some cron script, after which the web server user (www-data or something else, depends on the server) doesn't have access to it.

I'd start by a) making sure that FileCompiler is enabled (site config, it's enabled by default) and b) clearing FileCompiler folder under /site/assests/cache/ and making sure that it's writable for your apache user.

  • Like 2
Link to comment
Share on other sites

ProcessRedirects missing the namespace definitely sounds like a FileCompiler issue. It's an old module and I'm pretty sure that even the latest versions don't have namespace defined (on mobile so can't check right now), but in such cases FileCompiler should kick in and store the compiled, namespaced version under cache ?

  • Like 2
Link to comment
Share on other sites

Great to hear that it's working now ?

As I mentioned above, in my case FileCompiler issues have usually been a result of something other than the Apache user (www-data, i.e. web requests) starting up (bootstrapping) ProcessWire and/or creating directories/files on the disk. Cron scripts or some scripts you might('ve) run manually on the server. So if you have scripts that could've bootstrapped ProcessWire or performed actions on (cache)files of the site, there's one possible culprit at least.

Of course it could also be some strange server-side issue, or a configuration change somewhere (though you did say that such changes shouldn't have happened, so this does seem unlikely).

You mentioned changing something in Hanna Code; while I can't think of a direct connection right away, it does seem like a curious coincidence. Hanna Code writes files under cache as well, but it really shouldn't have any effect on FileCompiler... but it could be a combination of multiple things, who knows ?‍♂️

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...