Vincentius Kevin Vincentius Kevin - 7 months ago 26
PHP Question

PDO does not run when I upload to web hosting?

mysql is deprecated and people recommend PDO over mysqli. I followed tutorials to connect a submission form with a database and it worked on my localhost (I use xampp), but when I upload them to some free web hosting services, the PHP works, except when it uses PDO (e.g. when connecting to database).

I have tried quite many free hosting services but PDO doesn't work everywhere. I wonder if this is normal, is there any free hosting service that supports PDO, or do I have to do something for the PDO to work ? But I didn't do anything to my localhost server and it worked.


It seems like PDO Is not available, you can do something like this to check if PDO is installed/exists.

 echo "PDO exists";
echo "PDO does not exist"; 


var_dump(get_declared_classes()) -- and see if PDO is there.