I'm getting this error message on my new Drupal 7 installation
Fatal error: Class 'PDO' not found in /home/.../public_html/drupal/includes/database/database.inc on line 184
Update: I've added the php.ini file to my root/drupal folder
Code which I've added to that
memory_limit = 128M
safe_mode = off
session.cache_limiter = nocache
open_basedir = none
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so
I also followed the instructions at http://wiki.lunarpages.com/Php.ini_settings
"Then, add the following line into the .htaccess file in your public_html"
suPHP_ConfigPath /home/username/public_html
and I'm still getting the same error message. Please help me to resolve this problem.
In created and uploaded a phpinfo.php file and viewed the results but I don't know what I'm supposed to look for.
------
I'm trying to get a new Drupal 7 installation running
My host is Lunarpages
I searched the forum and I see others had the same problem (but maybe in Drupal 6 it was a memory problem?). Can somebody explain to me more clearly how to resolve this problem. I am technically adept, and computer literate, but not a webmaster-php-whiz.
In my Drupal installation there is no php.ini file in root/drupal
*The post http://drupal.org/node/570452 says*
PDO support had been compiled in, but not enabled .
Adding
extension=pdo.so
extension=pdo_mysql.so
to my php.ini solved the problem."
*matw8 resolved his problem with by adding the below*
http://drupal.org/node/1067176
memory_limit = 128M
safe_mode = off
session.cache_limiter = nocache
open_basedir = none
extension = pdo.so
extension = pdo_mysql.so
*On my site Drupal is installed in root/drupal
the php.ini file in root contains*
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so
In my Drupal installation there is no php.ini file in root/drupal
Other related posts:
http://diggit.drupalextras.com/node/11503/related_links
http://diggit.drupalextras.com/node/78837/related_links
http://diggit.drupalextras.com/node/42309/related_links
http://diggit.drupalextras.com/node/16903/related_links
Comments
Hi, I think I've documented
Hi, I think I've documented the problem well. I've also continued trying to resolve the problem. Please give me some guidance. I'm stuck.
Started from Scratch, Error Messages
Problem Resolved: I started over from scratch, and this time I paid close attention to the error messages.
I posted a message to the Lunarpages Help Desk:
I attempted to install Drupal today and I got the below error messages. How do I fix these.
1. PHP extensions ***Error
PHP extensions Disabled
Drupal requires you to enable the PHP extensions in the following list (see the system requirements page for more information):
2. pdo ****Error
Database support Disabled
Your web server does not appear to support PDO (PHP Data Objects). Ask your hosting provider if they support the native PDO extension. See the system requirements page for more information.
3. PHP Memory *** Warning
PHP memory limit 8M
Consider increasing your PHP memory limit to 32M to help prevent errors in the installation process. Increase the memory limit by editing the memory_limit parameter in the file /home/balazs2/public_html/php.ini and then restart your web server (or contact your system administrator or hosting provider for assistance). See the Drupal requirements for more information.
Thank you for contacting Lunarpages Internet Solutions & Web Hosting.
......
The helpful response I got from the Lunarpages Help Desk
1) If you want to enable all disabled function for your account. Please add the following code in your php.ini (this file is not created by default you would need to upload or create it in public_html)
==================
disabled_functions = ""
==================
2.) To enable PDO, please try adding the following lines into your php.ini file which can be located under your public_html folder (this file is not given by default you would need to manually create or upload it).
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so
3.) Because we use suPHP to parse php files, you have the option of using a custom php.ini file.
You can change the settings for the PHP directives in your php.ini file which can be located under your public_html folder (this file is not given by default you would need to manually create or upload it) by adding the following code:
memory_limit = 32M
You can also create a .htaccess file in the same folder as the php.ini file and place the following code into it:
suPHP_ConfigPath /home/username/public_html/
where "username" is your cPanel username. This will cause the php.ini file to affect all subfolders, unless a php.ini file is in a subfolder, at which point the php.ini in the subfolder takes precedence.
You should only use the settings you need to change in your php.ini.
For the PHP settings you do not have in your php.ini file, PHP will use our default configurations.
Updating php.ini file worked for me
Adding these two lines resolved my error message:
extension="pdo.so"
extension="pdo_mysql.so"
Thanks to everyone who responded to this issue.
Solved : memory size exhausted & PDO class problem
I have just installed Drupal 7 & have been having memory problems whilst in admin tasks, particularly with the Views module which completely failed to save a new view I was trying to create.
The error was:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /home/thedest1/public_html/rhemahousing.co.uk/dr/modules/ckeditor/includes/ckeditor.page.inc on line 113
I tried adding a php.ini file to my /drupal folder. The file had the contents:
php_value memory_limit = "128M"
this resulted in a different error:
Fatal error: Class 'PDO' not found in .... /includes/database/database.inc on line 184
I have now placed the following code in a php.ini file in my drupal directory. This has solved the problem. I don't understand why, but I'm happy!
php_value memory_limit = "128M"
safe_mode = off
session.cache_limiter = nocache
open_basedir = none
extension = pdo.so
extension = pdo_mysql.so
I hope this helps anyone else with a similar problem.
OK
problem solved with this solution, thanks.
having this issue..
line 184 in the
includes/database/database.inc
added the lines above for a local php.ini file but didn't work.. wondering if I need to modify the top level directory php.ini file which I do not have access to..
''The secret though is just keep walking through life without analyzing it too much or clinging to it too much. Just walk on.'' - Marilyn Silverstone, Magnum Photographer & Buddhist Nun, b. March 9, 1929, October 1999.
worked w my hosting provider to find the solution here..
http://drupal.org/node/1036110
added a revised php.ini to the main directory and issue was resolved..
''The secret though is just keep walking through life without analyzing it too much or clinging to it too much. Just walk on.'' - Marilyn Silverstone, Magnum Photographer & Buddhist Nun, b. March 9, 1929, October 1999.
Yeppers this worked for me.
Yeppers this worked for me. THANKS!!!!
Also Check Extension_Dir
I had the same situation and tried everything listed here, and it still wouldn't work.
Then I realized that I must have set extension_dir some time in the past. I just commented it out and it worked (just let it use the default value).
HTH.
GreenGeeks
I had to contact GreenGeeks for a solution. This is the code for the custom php.ini file I dropped in my public.html folder:
register_globals = Off
extension="pdo.so"
extension="pdo_mysql.so"
memory_limit=128M
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
zend_extension="/usr/local/IonCube/ioncube_loader_lin_5.2.so"
Worked like a charm.
Updated GreenGeeks solution
My old php.ini file was rather full of code scratchouts. No idea why it suddenly stopped working. At the suggestion of the GreenGeeks tech support, I renamed it and created a new, blank php.ini file in my public_html directory and added the following to it:
extension=mcrypt.so
short_open_tag = on
extension=pdo.so
extension=pdo_mysql.so
extension=pdo_sqlite.so
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
zend_extension="/usr/local/IonCube/ioncube_loader_lin_5.2.so"
Also had to make sure the following line was in .htaccess:
SetEnv PHPRC /home/cPanelUser/public_html/php.ini
Note: Make sure to replace 'cPanelUser' with the actual username for your account.
it does not work for me! I've
it does not work for me! I've done every every thing which is told in this page but no answer!! what should I do?!
I'm going crazy!!
Thank you
Thanksssssssssssssssssssssss you.
One of my website was down for almost 6 month due to this error and I couldn't able to solve it. Now it start working again after I add this line
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so
Best,
This worked for me... thanks!
This worked for me... thanks! I had never encountered this issue with previous D7 installs. My php.ini file only contained a line to deal with register_globals and it was causing the PDO error.
And me too!
You never know what is coming next with Drupal - but when it works it is great!
Thanks to all those that went before me toiling for answers...You have all made my day!
I am sure others will stumble into the same pit but hey with patience they will discover the answers themselves...
... a one liner on the php.ini file apparently failed me also until I got here!
Class 'PDO' not found in database.inc
I had a working copy of the latest drupal 7.
I only encountered this error yesterday and had not added anything to the system.
Prior to this (a week ago) I had been adding modules but had no errors.
I changed the setup based on the following post: I am running PHP 5.4
************************************************************************************
I've been having some issues with Drupal 7 since installation, namely enabling Clean URL's, some Views errors, etc. I remembered during the installation reading that PHP 5.2.5 was the minimum requirement for installation. I wasn't sure which version of PHP my server was running, I created a new php file called phpinfo.php with the following code:
phpinfo();
Turns out I was running 5.2.15. Not being up to date on the latest versions, I assumed 5.2.15 was lesser than 5.2.5 (I found out later that I assumed incorrectly). Anyway, my host was running both 5.2.12 and 5.3.3, so I installed 5.3.3 by adding this to my .htaccess file : Action application/x-hg-php53 /cgi-sys/php53
AddType application/x-hg-php53 .php
I ran phpinfo.php again, and saw PHP 5.3.3 successfully enabled. Problem is, when I went back to my site, I got the misleading "Fatal error: Class 'PDO' not found in /home/public_html/includes/database/database.inc on line 185" After a lot digging and going back-and-forth with my host, and realizing PDO was installed and enabled, and on my php.ini file these two line were already uncommented: extension=pdo.so
extension=pdo_mysql.so
I even tried running the update.php script, but got this: "PDO is required! Drupal 7 requires PHP 5.2.4 or higher with the PHP Data Objects (PDO) extension enabled. See the system requirements page for more information." I found lots of info on http://drupal.org/requirements and http://drupal.org/requirements/pdo, but neither seemed to fix my specific issue. Finally, I found this page http://drupal.org/node/887288 after searching for answers to the error from the update script. While it didn't clearly explain (to me) what was happening in my instance, it did get me to try a different database connection array as indicated in the thread. This ended up WORKING for me with Drupal 7 and PHP 5.3.3:
With PHP 5.2.15 the database connection array performed well when formatted as: $databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'db_name',
'username' => 'db_username',
'password' => 'passwd',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
However when upgrading to PHP 5.3.3 the following format is required: $databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'db_name',
'username' => 'db_username',
'password' => 'passwd',
'host' => 'localhost',
'prefix' => '',
);
Thanks for the posts in this thread!
Hi,
This happened out of the blue for me - I had made no changes
Commenting out extension_dir in the php.ini sorted it
;extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
Thanks again