I manage the website for the small company I work for, but I’m not an experienced server admin – I just kind of took over as the default IT guy because I knew more than the others. Generally speaking, I don’t know my way around a Windows server very well.
The site is hosted (off-site) on a VPS Windows Server 2012 R2 through Plesk. Most of the site is built in ancient ASP/VBScript, connecting to an SQL Server database. Most newer stuff that I’ve added/changed/fixed myself is PHP. The PHP version is 7.2.19, running as FastCGI.
Yesterday, the site was in perfect working condition, as far as I could tell. Earlier today, I went to check something on the website, and I noticed most of the images loaded through asynchronous calls to a PHP script had gone missing even though nothing has changed on the server since yesterday.1 I ran the image-fetching PHP script on its own, and it turned out to be throwing a fatal error: the database class in my namespace suddenly couldn’t be found. Turns out this was true of every one of my classes in every PHP page: nothing can be found at all.
The classes are all loaded with a Composer autoloader (with a PSR-4 block defining where to pull classes from my own namespace from). The autoloader is
require_once’d correctly. I updated the Composer project and the autoloader just in case the autoloader itself had somehow become corrupt, but that had no effect.
What really puzzles me here is that it’s not consistent. If I reload the same page at various intervals, I seem to, quite randomly, get one of three different outcomes:
- Page loads successfully with no problems (rarest, only perhaps one in ten reloads)
Uncaught Error: Class 'MyNamespace\MyClass' not found in C:\...\File.php(followed by stack trace with only #0, the file called)
HTTP Error 500.0: C:\...\php-cgi.exe - The FastCGI process exited unexpectedly(Error code: 0x000000ff)
So sometimes it works, sometimes it executes the file but (for reasons I still can’t fathom) cannot find the classes, and sometimes it just crashes the PHP process completely. This is true of any PHP file that tries to load classes. If I make a simple test file that relies on nothing but itself and core functions/classes, it consistently loads fine; but as soon as I try to instantiate any non-core classes, it’s back to rolling the dice to see whether I’ll get an error, a crash or a page.
This is bizarre enough that I have no idea where to even look for a possible cause and how to fix it. It’s apparently also un-Googleable enough (or perhaps I’m just bad enough at Google) that I can’t find anything similar anywhere on the Internet.
What might be the cause of this bizarre behaviour, and more importantly, what can I do to get rid of it?
(As mentioned, I am not an experienced server admin. If I’ve left out some crucial information, please let me know how/where I can find it and I’ll be happy to add it in.)
1 There is apparently a Plesk update from earlier today (Update #56), but the Plesk panel shows that we’re on Update #55, so it doesn’t seem to have been applied yet. The previous update was a week ago, and the site has definitely been working just fine after that.