The joys of running websites is that you often end up troubleshooting issues that crop up. Sometimes the error can be something really simple, or fairly obvious. Like you switch to the latest version of PHP but forget to install all the required PHP modules. Other times, however, the error is more niggly than anything else, so you put it on the long finger.
In my case I’d been having ongoing issues with one of my personal blogs. It kept throwing errors, but then would behave long enough that I’d assume I’d fixed the issue. You’d get a rather “helpful” HTTP 500 error, but there was nothing in the logs that I could see. I tried tweaking the various plugins that I had installed and disabled a few to see if that would fix the errors, but it didn’t make any difference.
The apparent lack of any detailed logs of the error was really annoying, and plain weird. But I didn’t have time to explore the problem properly, until things came to a head over the weekend.
So it turns out there were logs, but I had been looking in the completely wrong place!
The PHP errors were being logged into a completely separate log file called (helpfully):
$sitename.php.error.log
Which instead of being in the same location as the main logs for the site, or even for the server, were in:
/home/$user/logs
So once I started tracking that log file I quickly realised that the issue was memory related.
Now this is where it got a little odd.
The server’s PHP memory limits were set at a “sane” value and none of the other sites on there were having any memory issues.
So why on earth was this one site hitting problems?
To add to the head scratching the error was about a relatively low amount of memory causing the issue.
So what was going on?
One of the features in cPanel is that at the user level you can tweak your PHP settings. Probably very useful in some circumstances, but since I have full root access on the entire server it’s not something I’d normally mess around with.
But, for some odd reason, there was a PHP.ini override in the user’s home directory. And it had a stupidly low memory limit.
Some more poking around led to me discovering that the setting had been made when the site was running php 7.3 (no idea by whom of course!).
Anyway fixing the memory limit in cPanel made the problem go away – at least for now!
Thanks to one of my team who were able to help me fix this – I was really getting ready to give up!
Leave a Reply