pdo module is enabled but I have PHP Fatal error: Class 'PDO' not found !
the PDO was enabled in php.ini.
but problem caused by php version and by upgrading php, problem solved.
No solution here works for my Class 'PDO' not found.
Contact your Hosting support and let them enable PDO for you.
In some hosting you can overwrite php.ini by creating php.ini file in your hosting root. These are the extensions you need to enable in php.ini if you are in windows hosting.
extension=php_pdo.dll
extension=php_pdo_mysql.dll
Edit:
Check if PDO is already installed by your hosting provider.
Create index.php file or any other file which you can access. The content must have
<?php
phpinfo();
?>
If PDO is installed already, the next thing to do is running composer install (SSH access required). You must delete your vendor folder beforehand. Assuming that your public folder is /var/www/html. go to the html directory and run
composer install
Fatal error: Class 'PDO' not found ( but it is installed and works on the terminal )
Ok, here is how I fixed this issue in case anyone else comes across facing the same problem.
I created a copy of the php.ini file, deleted the original, refreshed the test.php file through the web browser, copied the php.ini file back to its original place.
And that fixed it.
Laravel 5.5 Class 'PDO' not found
What is most likely happening here is that the PDO module is enabled in the php-cli config (hence it works from command line), but is not enabled on the web server configuration file.
Fatal error: Class 'PDO' not found
If you compare the output of your phpinfo()
function to the other directories, where it is working you'll notice that the PDO object is indeed not loaded and that it is using a different php.ini
in the directory where it is not working. On the working parts PHP is using /usr/local/lib/php.ini
while it is using /home/itstec2/public_html/php.ini
in the directory where it isn't working.
Some providers allow you to use different PHP configurations for different parts within the web root. If you use an extra ini file for a specific directory you have to make sure that you have all necessary settings in there.
PHP Fatal error: Class PDO not found (mysql/Docker)
As I use CloudFoundry, the Dockerfile is not used.
I found out that the fix is adding a new file:
.bp-config/options.json
{
"WEBDIR": "public",
"PHP_EXTENSIONS": ["gd", "pdo", "mysql", "pdo_mysql"]
}
Related Topics
What Is the Default Lifetime of a Session
How to Select First 10 Words of a Sentence
Best Way to Completely Destroy a Session - Even If the Browser Is Not Closed
Preserve Key Order (Stable Sort) When Sorting With PHP'S Uasort
How to Disable Output Buffering in PHP
Submit an HTML Form With Empty Checkboxes
Using Default Arguments in a Function
Passing an Array as Arguments, Not an Array, in PHP
Access Controller Method from Another Controller in Laravel 5
Create Ini File, Write Values in PHP
How to Access PHP With the Command Line on Windows
Read Each Line of Txt File to New Array Element
Convert Timestamp to Readable Date/Time PHP