How to make PHP command line work with PDO?

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

But when I execute the command: php test.php, it talks about an unknown PDO class.

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

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, downloadable from here .
  • OS: Windows Vista li>

If the problem is with modules, where can I get thread-safe modules for these modules?

+3
source share
3 answers

PHP ( "on" PHP, ). Grab - ( "nts" ) PHP , , .

+1

, , API = 20060613, debug = 0, thread-safety = 0 PHP API = 20060613, debug = 0, thread-safety = 1

. , .

+1

, extension_dir php.ini. .

0

Source: https://habr.com/ru/post/1718187/


All Articles