Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP PDO extension not available is command line

I've moved from WAMP to EasyPHP and now there are problems using PDO. PDO works fine when I view the site in the browser, but doesn't work in cmd or when I run the test file via Netbeans. I get:

"PDOException: could not find driver"

In phpinfo() for Configure Command I have

cscript /nologo configure.js " --enable-snapshot-build" " --disable-isapi" " --enable-debug-pack" " --disable-isapi" " --without-mssql" " --without-pdo-mssql" " --without-pi3web" " --with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk, shared" " --with-oci8=D:\php-sdk\oracle\instantclient10\sdk, shared" " --with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk, shared" " --enable-object-out-dir=../obj/" " --enable-com-dotnet" " --with-mcrypt=static" " --disable-static-analyze"

In php.ini I have already uncommented these lines:

extension=php_pdo_mysql.dll

extension=php_mysql.dll

Any ideas on how I can get this working?

like image 357
Dalton Tan Avatar asked Sep 29 '11 13:09

Dalton Tan


People also ask

How do I know if PHP PDO is installed?

Generally you can just do phpinfo(); to find out what modules are installed. Additionally you could use: class_exists('PDO') to find out whether the PDO class indeed is accessible.

Does PHP 5.4 support PDO?

PDO will not run since upgrading PHP to 5.4.

Is PHP PDO deprecated?

PHP 8.1: PDO::FETCH_SERIALIZE is deprecated This functionality, however, is broken and is unusable.


2 Answers

When running php from the command line, you can use the -c or --php-ini argument to point to the php.ini file to use. This will allow you to use one php.ini file for both. You can also alias php to php -c/path/to/php.ini if you are running the script yourself.

like image 191
Explosion Pills Avatar answered Nov 04 '22 02:11

Explosion Pills


All web server install should you be in linux or windows usually use 2 different php.ini. One for the CLI (Command line client) and one for APACHE or wathever the server is in easyphp.

I can't help you more than that since i'm on linux and don't use EasyPHP, but look in that direction, maybe a system wide search can help you out?

like image 25
Mathieu Dumoulin Avatar answered Nov 04 '22 02:11

Mathieu Dumoulin