首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使PHP命令行与PDO一起工作?

如何使PHP命令行与PDO一起工作?
EN

Stack Overflow用户
提问于 2009-09-21 12:51:39
回答 3查看 3.1K关注 0票数 3

我想通过PHP命令行使用PDO。--它通过PHP工作得很完美,但不是通过命令行.

但是,当我执行命令: PDO时,它说的是未知类test.php。

我认为这与线程安全的差异有关。因为,当我执行上述命令时,会出现以下警告:

代码语言:javascript
复制
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版本: 5.2.9-2,从这里下载。
  • 操作系统: Windows

如果问题在于模块,那么在哪里可以获得这些模块的线程安全模块呢?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2009-09-21 19:02:27

您的PHP和您的模块是用不同的线程安全性编译的(在PHP中打开"on“,在模块中”关闭“)。获取正确的非线程安全 (或"nts")构建的PHP以匹配您试图使用的模块,您的问题应该会得到解决。

票数 1
EN

Stack Overflow用户

发布于 2009-09-22 06:34:17

啊,您可以看到用模块API=20060613编译的模块,debug=0,用模块API=20060613、debug=0、thread-safety=1编译的

螺纹安全错配。你需要打开线程安全的。

票数 1
EN

Stack Overflow用户

发布于 2009-09-21 13:46:13

在您的extension_dir中定义php.ini时出错。试着把绝对的路径放在那里。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1454358

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档