By Ben Nitkin on
A few days ago, IMeanWebHosting ran a system update. (I rent hosting space from them.) For some reason or another, the update reset PHP settings, including extensions, upload limits, and their ilk.
My website was replaced by a one-line message:
Fatal error: Class 'PDO' not found in /home/nitkinne/public_html/includes/database/database.inc on line 184
As exciting as single-line errors are, they don't quite meet mettle for my website.
Parsing that message, it seems to be complaining that PHP was missing a class. Searching the order online, I learned that PDO stands for PHP Data Objects. It's provided by two modules:
extension="pdo.so"
Now, I know that the lines above belong in a php.ini file. Problem is, I don't know where php.ini is. I could create a new one with only those two lines, but I'd lose all of the settings in the existing php.ini (only one is sourced.)
extension="pdo_mysql.so"
So, I needed to find out where the existing php.ini lived, and try to copy it. Another search hinted at the following line to fetch the global copy of php.ini and plop it into my home directory.
exec("cp /PATH/TO/php.ini /home/nitkinne/public_html/php.ini");
The only challenge left was to find php.ini. PHP provides a function, phpinfo(), which returns almost all of PHP's current settings as nicely formatted HTML. This includes the configuration file's location.
I plugged the location into the cp command, copied the line of code onto the server, loaded the page to execute it, returned to FileZilla, and found php.ini waiting for me.
Nice!
From there, it was trivial to add the two lines I needed. And the site was back!