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
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.
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:
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.
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.
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”.
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,
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):
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.