mdg_imc icon indicating copy to clipboard operation
mdg_imc copied to clipboard

Fatal error: Uncaught exception

Open MBarisonek opened this issue 12 years ago • 9 comments

When I typed in php shell/imc.php I got this error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in /Applications/MAMP/htdocs/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php:129

Any ideas on what's going on?

MBarisonek avatar Jan 23 '14 20:01 MBarisonek

I get the same error. Anyone has idea how to solve? Tks

franciscoprado avatar Feb 27 '14 19:02 franciscoprado

Interesting can you let me know which version of MAMP, PHP are you trying to use ? I will try to replicate on my end

amacgregor avatar Mar 06 '14 16:03 amacgregor

In my case, I use LAMP. I've already tried on Windows, using XAMPP, but the problem is the same.

franciscoprado avatar Mar 06 '14 23:03 franciscoprado

Francisco,

Can you let me know the specific version of php and XAMPP you are using also, imc won't work on windows do to unsupported libraries

amacgregor avatar Mar 07 '14 00:03 amacgregor

PHP Version 5.5.9 XAMPP for Linux 1.8.3-3

The output on my terminal:

francisco@francisco:/opt/lampp/htdocs/magento$ php shell/imc.php PHP Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'pdo_mysql extension is not installed' in /opt/lampp/htdocs/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php:309 Stack trace: #0 /opt/lampp/htdocs/magento/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect() #1 /opt/lampp/htdocs/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array) #2 /opt/lampp/htdocs/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array) #3 /opt/lampp/htdocs/magento/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8') #4 /opt/lampp/htdocs/magento/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element)) #5 /opt/lampp/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_write') #6 /opt/lampp/htdocs/magent in /opt/lampp/htdocs/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 309

It says there is no "pdo_mysql" extension installed, but it is installed (at least checking via phpinfo here).

franciscoprado avatar Mar 07 '14 01:03 franciscoprado

@amacgregor @franciscoprado forgive me if I am wrong, but are you using Vagrant? If so, the PDO Exception is thrown due to a failure to connect to the database. And this makes sense because your database does not live on host, rather, it lives in your VM. If this is the case, try vagrant ssh into your box. Then, cd /vagrant/ and run your php script from wherever it lives in your project root.

justinpage avatar Aug 13 '14 22:08 justinpage

@KLVTZ I'm having the same error and i'm not using Vagrant. @franciscoprado @amacgregor @MBarisonek, Did someone found the solution?

miguelpfaraujo avatar Nov 25 '14 18:11 miguelpfaraujo

I'm working on the second edition of the book and I'm having the same problem. I'm using AMPPS 3.6 on Windows 10.

knospe- avatar Mar 15 '17 22:03 knospe-

I was able to solve this issue by following the advice as described on: http://devdocs.magento.com/guides/v2.0/install-gde/trouble/php/tshoot_phpini.html

This is commonly caused by a different instance of PHP being used by the PHP command line compared to the web server. In particular, mysql.sock might be misconfigured if this is the case.

To determine whether or not you’re using one instance of PHP:

Log in to your Magento server.

Enter the following command:

php -i | grep 'php.ini'

This determines the settings used by the PHP command-line interface (CLI). Note where php.ini is located. If you haven’t already done so, set up a phpinfo.php on your web server. Compare the value of Loaded Configuration File from phpinfo.php with the one from php -i. phpinfo.php shows the php.ini file used by your web server. If it’s different from what’s in PHP’s php.ini, you must make all PHP settings consistent for both the PHP CLI and the web server.

liezie avatar Mar 10 '18 15:03 liezie