How to get PHP command line to work with PDO?

Posted by Sabya on Stack Overflow See other posts from Stack Overflow or by Sabya
Published on 2009-09-21T12:51:39Z Indexed on 2010/04/09 9:43 UTC
Read the original article Hit count: 527

Filed under:
|
|

I want to work with PDO, through PHP command line. It works perfect through the PHP web API, but not through the command line.

But when I execute the command: php test.php, it says unknown class PDO.

I think it has something to do with the thread-safety difference. Because, when I execute the above command, the following warnings come: -

F:\shema\htdocs>php test.php
PHP Warning:  PHP Startup: soap: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: sockets: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: mysql: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: pdo_mysql: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: pdo_pgsql: Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=1
These options need to match
 in Unknown on line 0
PHP Fatal error:  Class 'PDO' not found in F:\shema\htdocs\test.php on line 2
  • PHP version: 5.2.9-2, downloaded from here.
  • OS: Windows Vista

If the problem is with the modules, where do I get the thread safe modules for those modules?

© Stack Overflow or respective owner

Related posts about php

Related posts about pdo