Forgotten MYSQL Connection Crashing Site ANNOYING!
So i had noticed that this site was crashing for the past few days, and i knew that is was a mysql issue. But this site does not run on MYSQL so WTF!
I removed some random tables that had some search data in them and other random things, but it was still getting cained by some stupid bots or something.
If i stopped the mysql service it would fix the server, but this site would give the message.
Connection failed: No such file or directory
I knew this sounded like some kinda random mysql error, but this site does not use MYSQL does it? I had not updated the source on here since years ago, but its usually running fine.
It loads all the class extends on each page load even if it does not use the data so i guessed i must have added a mysql connection and forgotten about it.
But within the hundreds of files how do i locate the connection, as if i disable the mysql service the whole site just shows the connection failed message.
Apparently VSCODE has a search function where you can search for a string across all your files, nice!
So all I had to do i find what the connection string was and then it would point me to the file.
I searched for the generic stuff, mysql, sql, and there were hundreds of refs and then i searched for
"new mysqli"
You can do this in VS Code with CTRL + SHIFT + F just make sure you have the exact target site loaded when doing this or it will show everything on the server.
And it found the code! Apparently i had a mysql connection on a words class extend that i had forgotten about, i dont think it was even being used anymore, but it loaded the class and connected to the database and for some reason this was crashing the site and server. I think there may have been a page i added to search the words or give random words or soemthing it is basically a full dictionary of all english language words and the word types or soemthing and it has a thesauras on there as well with the meanings so i guess the AI bots were calling this over and over and crashing my tiny little server, lol...
I was going to convert this site totally to just JSON data and load them all from flat files, but the sqlite seems to be running nicely still.
So i diabled that class extend from loading and the site is running fine now. Yay...