Try the Demo

Magento

eCommerce Software for Online Growth

Magento Forum

Our new hosted solution for small & emerging businesses
   
Page 1 of 2
Sudden “pdo_mysql extension is not installed” !!! {Solved}
 
reststop
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2008-05-22
 

Suddenly on 27-Aug-08 I began getting the “pdo_mysql extension is not installed” error, and AFAIK I didn’t do anything to make it happen.

Both my store home page, and the admin page I had been using earlier in the day just gave me the error-report page!

A search of the forum showed a fix for sites where the hosting site didn’t support pdo_mysql, or it was missing. Add to the existing php.ini file:

extension=pdo.so 
extension
=pdo_mysql.so
extension
=pdo_sqlite.so
Since I was using php5-cgi, (my hosting service was still at php 4.4.4), and should not have been affected, I was skeptical but made the change, incorporating those lines into the php.sample.ini included with Magento, and named it php.ini.

Great!  My home page and admin pages came back.

Next, I went to use Magento Connection Manager, and got the error.

Fatal error: Uncaught exception ‘Zend_Db_Adapter_Exception’ with message ‘pdo_mysql extension is not installed’ on

Still believing I was using php5-cgi in all places, I checked my .htaccess files and they looked good. I tried putting php.ini files into a bunch of code directories, all to no avail.  I decided to let it sit, and got back to working on organizing and populating my store by creating categories and some basic products to get the hang of things, and see how they display.

-- No one had responded to this thread, and nothing new was found elsewhere on the forum that helped. --

I decided to do a complete clean install of Magento in another directory.  This time, I got the message at installation saying that “pdo_mysql” was not installed and was required.  Huh?  Didn’t get that a few days ago on the 26th when I installed Magento 1.1.3, before all this started to happen.  Put in the php.ini code, and proceeded just fine.  However, Magento Connection Manager still did not work.

I rechecked the .htaccess files, and the php.ini files, and found a ‘#’ out of place in .htaccess.  Hmmm. I created phpinfo.php and copied it to each magento subdirectory (/magento, and /store) and put a copy in my base public_html directory:

<?php phpinfo(); ?>
Interesting.  My hosting service apparently upgraded their PHP version to 5.2.6 (Build Date Aug 26 2008 22:53:53) right between my installation of 1.1.3 which had appeared to run just fine, and my “Suddenly” having problems with my site on the 27th. In my /store directory, I went in and fixed .htaccess to uncomment the lines:
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi

##    Action php5-cgi /cgi-bin/php5-cgi
##    AddHandler php5-cgi .php
            --- to read ---
      
Action php5-cgi /cgi-bin/php5-cgi
      AddHandler php5
-cgi .php
and found that my /store version indeed was correctly using the php5-cgi with PHP version 5.2.3 which was the required implementation while my hosting service continued to use PHP version 4.4.4.

This got ME up and running again, but didn’t resolve the problem with why (now that I had a server supported version 5.2.6) pdo_mysql was missing.

 Signature 

-Carl

Golden State Gift Baskets
We Make It Easy to say “Thank You!”
Catalyst Industries
Internet / eCommerce Consulting & Project Management

 
Magento Community Magento Community
Magento Community
Magento Community
 
reststop
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2008-05-22
 

Addendum:

I examined the output from phpinfo() from within my /magento, /store and base directories. The crux of the issue is whether the pdo_mysql extension is loaded by default, or requires a specific load statement.  (Can’t this be handled in the actual php source code with a ‘require’-like statement? I’m not fluent in all the possible library module loading capabilities of PHP, but other languages I’ve used, handle this without having to call out extensions in a master init file, when they ought to be called out for optional inclusion where needed.)

Here’s the result of my investigation:

In the config section of phpinfo(), the php5-cgi version in /store showed:

./configure’ ‘--enable-static’ ‘--enable-cgi’ ‘--enable-force-cgi-redirect’ ‘--with-config-file-path=/etc/php5cgi’ ‘--prefix=/usr/local/php5cgi’ ‘--with-gd’ ‘--with-mysql’ ‘--with-mcrypt’ ‘--with-mhash’ ‘--with-curl’ ‘--enable-ftp’ ‘--with-openssl’ ‘--with-dom’ ‘--enable-sockets’ ‘--with-zlib’ ‘--with-zlib-dir=/usr/include’ ‘--with-pear’ ‘--with-jpeg’ ‘--with-png’ ‘--with-freetype’ ‘--with-jpeg-dir’ ‘--with-png-dir’ ‘--with-pdo-mysql’ ‘--with-mysqli’

while the hosting service php5 in /magento showed:

‘./configure’ ‘--enable-bcmath’ ‘--enable-calendar’ ‘--enable-exif’ ‘--enable-ftp’ ‘--enable-gd-native-ttf’ ‘--enable-libxml’ ‘--enable-magic-quotes’ ‘--enable-mbstring’ ‘--enable-pdo=shared’ ‘--enable-soap’ ‘--enable-sockets’ ‘--enable-wddx’ ‘--enable-zip’ ‘--prefix=/usr’ ‘--with-curl=/opt/curlssl/’ ‘--with-freetype-dir=/usr’ ‘--with-gd’ ‘--with-gettext’ ‘--with-imap=/opt/php_with_imap_client/’ ‘--with-imap-ssl=/usr’ ‘--with-jpeg-dir=/usr’ ‘--with-kerberos’ ‘--with-libexpat-dir=/usr’ ‘--with-libxml-dir=/opt/xml2’ ‘--with-libxml-dir=/opt/xml2/’ ‘--with-mcrypt=/opt/libmcrypt/’ ‘--with-mhash=/opt/mhash/’ ‘--with-mysql=/usr’ ‘--with-mysql-sock=/var/lib/mysql/mysql.sock’ ‘--with-mysqli=/usr/bin/mysql_config’ ‘--with-openssl=/usr’ ‘--with-openssl-dir=/usr’ ‘--with-pdo-mysql=shared’ ‘--with-pdo-sqlite=shared’ ‘--with-png-dir=/usr’ ‘--with-pspell’ ‘--with-sqlite=shared’ ‘--with-tidy=/opt/tidy/’ ‘--with-ttf’ ‘--with-xmlrpc’ ‘--with-xpm-dir=/usr/X11R6’ ‘--with-xsl=/opt/xslt/’ ‘--with-zlib’ ‘--with-zlib-dir=/usr’

OK!  The problem is clearly:

'--with-pdo-mysql'
vs
'--with-pdo-mysql=shared'

The proposed solution for the non-programmer is to create a simple php.ini file:

added when pdo_mysql is shared (or missing)
extension=pdo.so 
extension
=pdo_mysql.so
extension
=pdo_sqlite.so
As far as I know and understand things, this should augment the system php.ini file and not replace it, so this is OK.
Problem solved! ... Not quite.

To get Magento Connection Manager to work, you need to put php.ini into the ”/downloader” directory as well. In my case, this is my original ”/magento/downloader” directory.

I would think that just having it in the base magento directory would be enough, but apparently it is required (at least on my hosting service) in the downloader subdirectory based on the current sources from Varien.

This brings up the question, ”What other services will fail? (...if any)”, and is there a way to fix this without putting a php.ini file in every blink’in directory?

If someone can answer that, I’d like to know!
If someone from the Magento core team can comment on whether this can be prevented from occurring in future releases, I’d certainly would like to know.

Thanks—and I hope that this helps someone else who runs into a similar problem.

 Signature 

-Carl

Golden State Gift Baskets
We Make It Easy to say “Thank You!”
Catalyst Industries
Internet / eCommerce Consulting & Project Management

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paulus
Sr. Member
 
Total Posts:  300
Joined:  2008-07-21
 

We had the exact same issue. After a week of not looking at the store we decided to continue working on it, and guess what: Just like that all we got was errors.  Going to read through your post and try to fix it here as well.

 Signature 

Paul
Fighting with 1.6.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
Paulus
Sr. Member
 
Total Posts:  300
Joined:  2008-07-21
 

Adding these seemed to do the trick:
extension=pdo.so
extension=pdo_mysql.so
extension=pdo_sqlite.so

Not sure why this happened all of a sudden though.

 Signature 

Paul
Fighting with 1.6.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
reststop
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2008-05-22
 

Hi Paulus,

I’d seriously check to see if there have been any changes made to your hosting site.

Put a file, phpinfo.php into your base store directory, and another on in your public_html directory (assuming they are not the same) with the file contents:

<?php phpinfo(); ?>
and look closely at the results.  In particular, check the top few boxes of the table, System, Build Date, and Configure Command.

Those will contain the build dates for the Operating System, for PHP, and the command used to configure PHP.  On my hosting service, these say:

Systgem Linux highlander.websitewelcome.com 2.6.25.15-grsec #10 SMP Mon Aug 11 22:59:55 CDT 2008 i686
Which says that the kernel was rebuilt on Monday August 11th 2008—unix kernel changes can affect your hosting environment

Build Date Aug 26 2008 22:53:53
Which says that the hosting company, or their system administration group installed a PHP version which was built 4 days ago!

Configure Command ... look for any parts with PDO in it ...
... ‘--enable-pdo=shared’
... ‘--with-pdo-mysql=shared’ ‘--with-pdo-sqlite=shared’
Which says PDO is enabled, (shared), and pdo_mysql and pdo_sqlite are included as shared libraries, and are only loaded when requested.

The “extension=pdo_mysql.so” line tells PHP to load the ”shared object” library.  A “.so” file type says it is a shared object library on most unix and linux systems.

On my store right now, I’m setup using php5-cgi, which has a build date of August 31, 2007 (a year ago), and the configuration contains ‘--with-pdo-mysql’ which is not shared, so it is a library included with the PHP code “always”.

 Signature 

-Carl

Golden State Gift Baskets
We Make It Easy to say “Thank You!”
Catalyst Industries
Internet / eCommerce Consulting & Project Management

 
Magento Community Magento Community
Magento Community
Magento Community
 
Business Feet
Sr. Member
 
Total Posts:  82
Joined:  2008-05-24
 

we just had the same issue after having our php recompiled.  make sure that the php.ini file has the correct extensions path

 Signature 

Internet Marketing Services

 
Magento Community Magento Community
Magento Community
Magento Community
 
saileruk
Jr. Member
 
Avatar
Total Posts:  25
Joined:  2008-08-21
 

got this problem as well. just happen suddenly.
and must say thanks to carl, if I didn’t see your post, dont know where should I go.

 Signature 

Half price on all shoes. Nike, Puma, Coach, Warrior, Y3 Yamamoto, Timberland and UGG.
http://www.betterol.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
John Y
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-12-02
 

had the same problem and uploaded the php.ini file to the downloader subdirectory as mentioned above.  worked out great!  thanks for this post!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Leo27
Sr. Member
 
Total Posts:  124
Joined:  2008-10-08
 

Hi an thank you very much,

I was going crazy, I was having the same problem, magento connect stoped working using php.ini in different folders, just working as a single php file. But adding my php.ini simply solved the problem,

Thanks again smile

best regards
L. Nunes

 
Magento Community Magento Community
Magento Community
Magento Community
 
RichardX
Jr. Member
 
Total Posts:  17
Joined:  2008-06-02
 

Hero points all round, you just saved my bacon smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
aliceweb
Jr. Member
 
Total Posts:  2
Joined:  2009-05-02
 

thanks

thank you very much to solve this

 
Magento Community Magento Community
Magento Community
Magento Community
 
AntArt
Jr. Member
 
Total Posts:  1
Joined:  2009-06-02
 

thank you Carl !

 
Magento Community Magento Community
Magento Community
Magento Community
 
riddle930
Jr. Member
 
Total Posts:  12
Joined:  2007-12-05
 

Carl, your a life saver, thanks for the help and explanation!

 
Magento Community Magento Community
Magento Community
Magento Community
 
krisb78
Jr. Member
 
Total Posts:  13
Joined:  2009-05-25
 

Hi,

I had exactly this problem this morning and the fix as described above worked perfectly.

I’m using Bluehost.

Thanks,

Kris.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles Albert
Member
 
Total Posts:  56
Joined:  2008-06-24
 

Hello everybody!
I just end up having the exactly same problem. The PDO libraries are all shared, so my Magento’s doesn’t work at all. I’ve tried to do the php.ini trick, creating the file with this code:

added when pdo_mysql is shared (or missing)
extension=pdo.so 
extension
=pdo_mysql.so
extension
=pdo_sqlite.so

An then putting it in the root of my magento’s installations. But it didn’t worked, my sites still with the same error.

I’ve also managed to get access to the main php.ini file of the server that I use, and to my surprise, the extensions are there! This is what is in that file (among others hundreds of lines):

extension=pdo.so
extension
=pdo_sqlite.so
extension
=pdo_mysql.so
extension
=pdo_pgsql.so

And still i have the same error. I don’t get why this is happening. Maybe reckless PHP recompilation? Or could the libraries be corrupted? IDK, and I would love some opinions over this.

Thanks in advance!

 Signature 

Charles Albert Martins dos Anjos
Gerente de Desenvolvimento - qu4troC
Especialistas Joomla! - Magento - Moodle - dotProject

 
Magento Community Magento Community
Magento Community
Magento Community
 
linuxed
Jr. Member
 
Total Posts:  3
Joined:  2009-05-14
Shelbyville, Ky.
 

For blue host I set my PHP to
PHP5 (Single php.ini)
Same as PHP5, but all subdirectories will use ~/public_html/php.ini

And put these lines in the php.ini file:
extension=pdo.so
extension=pdo_mysql.so
extension=pdo_sqlite.so

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2
 
© Copyright Magento Inc.
Privacy Policy|Terms of Service
Magento Community Count
819302 users|754 users currently online|519712 forum posts