调用 mysqli_fetch_array 时发生 PHP 致命错误
我正在使用 Drush,它在命令行中启动 php。我将初始的 php.ini 复制到本地目录中,以便 php 使用与 Web 服务器启动时相同的配置。当与网络服务器一起使用时,它运行良好。不幸的是,当使用命令行启动时,当 drush 调用 mysqli_fetch_array 和/或 mysqli_fetch_object 时,PHP 崩溃,而调用 mysqli_fetch_row 时一切正常......我在 Windows 下使用 EasyPHP 5.2.10。
错误消息: php.exe 中发生未处理的 win32 异常 [5772]。即时调试此异常失败,并出现以下错误:没有安装的调试器启用了即时调试。在 Visual Studio 中,可以从“工具”/“选项”/“调试”/“即时”启用即时调试。
根据评论中的要求,这里是有关 PHP 和 MySQLi 模块的信息。 备注:Client API 库版本和 Cient API 标头版本不同。然而,当使用网络服务器 phpinfo() 时,它们是相同的...这可能是问题所在吗?然而,这是一个全新的 easyPHP 安装...Oo'。
php -v
PHP 5.2.10 (cli)(构建时间:2009 年 6 月 17 日 16:16:57) 版权所有 (c) 1997-2009 PHP 集团 Zend Engine v2.2.0,版权所有 (c) 1998-2009 Zend Technologies
php -i
phpinfo() PHP版本=> 5.2.10
系统=> Windows NT APOLLON 5.1 版本 2600 构建日期=> 2009 年 6 月 17 日 16:16:01 配置命令=> cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap _5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\ instantclient10\sdk,共享 “--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,共享” 服务器API =>命令行界面 虚拟目录支持=>已启用 配置文件(php.ini)路径=> C:\WINDOWS 加载的配置文件=> C:\Program Files\EasyPHP5.2.10\www\drush\php.ini 扫描此目录以获取其他 .ini 文件 => (没有任何) 解析的其他 .ini 文件=> (没有任何) PHP API =>; 20041225 PHP 扩展 => 20060613 Zend 扩展 => 220060519 调试构建=>不 线程安全=>已启用 Zend 内存管理器 =>已启用 IPv6 支持 =>已启用 已注册 PHP Streams => php、文件、数据、http、ftp、compress.zlib 注册的流套接字传输 => TCP、UDP 注册流过滤器 => Convert.iconv.、string.rot13、string.toupper、string.tolower、string.strip_tags、convert.、consumed、zlib.*
该程序使用 Zend 脚本语言引擎: Zend Engine v2.2.0,版权所有 (c) 1998-2009 Zend Technologies
配置
PHP 核心
指令 =>本地值=>主值 allow_call_time_pass_reference =>;关=>离开 allow_url_fopen =>;上 =>在 allow_url_include =>;关=>离开 总是_populate_raw_post_data =>关=>离开 arg_separator.input =>; & => & arg_separator.output =>; & => & asp_tags =>;关=>离开 auto_append_file =>;无值=>没有价值 auto_globals_jit =>;上 =>在 auto_prepend_file =>;无值=>没有价值 浏览=>无值=>没有价值 默认字符集=>无值=>没有价值 default_mimetype =>;文本/html =>文本/html Define_syslog_variables =>;关闭=>离开 禁用_类=>无值=>没有价值 禁用功能=>无值=>没有价值 显示错误=>标准输出 =>标准输出 显示_启动_错误=>上 =>在 doc_root =>;无值=>没有价值 docref_ext =>;无值=>没有价值 docref_root =>;无值=>没有价值 启用_dl =>上 =>在 error_append_string =>;无值=>没有价值 错误日志=>无值=>没有价值 error_prepend_string =>;无值=>没有价值 错误报告=>第6143章6143 暴露_php =>上 =>在 扩展目录=> C:\Program Files\EasyPHP5.2.10\php\ext\ => C:\Program Files\EasyPHP5.2.10\php\ext\ 文件上传=>上 =>在 突出显示.bg => #FFFFFF=> #FFFFFF 突出显示.评论=> #FF8000=> #FF8000 突出显示.default => #0000BB=> #0000BB 突出显示.html => #000000=> #000000 突出显示.关键字=> #007700=> #007700 突出显示.string => #DD0000=> #DD0000 html_errors =>;关=>离开 忽略重复错误=>关闭=>离开 ignore_repeated_source =>;关闭=>离开 ignore_user_abort =>;关=>离开 隐式刷新=>上 =>在 include_path =>; .;C:\php5\pear => .;C:\php5\梨 log_errors =>;上 =>在 log_errors_max_len =>;第1024章1024 magic_quotes_gpc =>;关=>离开 magic_quotes_runtime =>;关闭=>离开 magic_quotes_sybase =>;关=>离开 mail.force_extra_parameters =>;无值=>没有价值 最大执行时间=> 0 => 0 max_input_nesting_level =>; 64 => 64 最大输入时间=> -1=> -1 内存限制=> 128M => 128M open_basedir =>;无值=>没有价值 输出缓冲=> 0 => 0 输出处理程序 =>无值=>没有价值 post_max_size =>; 8M=> 8M 精度=> 14=> 14 realpath_cache_size =>; 16K=> 16K realpath_cache_ttl =>;第120章120 register_argc_argv =>;上 =>在 register_globals =>;关=>离开 register_long_arrays =>;关=>离开 report_memleaks =>;上 =>在 report_zend_debug =>;关=>离开 安全模式=>关=>离开 safe_mode_exec_dir =>;无值=>没有价值 safe_mode_gid =>;关=>离开 safe_mode_include_dir =>;无值=>没有价值 sendmail_from =>;无值=>没有价值 发送邮件路径=>无值=>没有价值 序列化精度=> 100=> 100 Short_open_tag =>;关=>离开 SMTP =>本地主机 =>本地主机 smtp_端口 => 25=> 25 sql.safe_mode =>;关=>离开 track_errors =>;上 =>在 unserialize_callback_func =>;无值=>没有价值 upload_max_filesize =>; 2M=> 2M upload_tmp_dir =>; ${路径}\tmp\ => ${路径}\tmp\ 用户目录=>无值=>没有价值 变量_顺序=> GPCS=> GPCS xmlrpc_error_number =>; 0 => 0 xmlrpc_errors =>;关=>离开 y2k_compliance =>;上 =>在 zend.ze1_compatibility_mode =>;关=>关闭
[已跳过]
mysqli
MysqlI 支持 =>已启用 客户端API库版本=> 5.1.42 客户端 API 标头版本 => 5.0.51a MYSQLI_SOCKET =>; /tmp/mysql.sock
指令=>本地值=>主值 mysqli.default_host =>;无值=>没有价值 mysqli.default_port =>;第3306章3306 mysqli.default_pw =>;无值=>没有价值 mysqli.default_socket =>;无值=>没有价值 mysqli.default_user =>;无值=>没有价值 mysqli.max_links =>无限=>无限 mysqli.reconnect =>;关=>关闭
有什么想法吗?
问候。
I am using Drush which is launching php in command line. I copied my initial php.ini in my local directory so that php is using the same configuration as if it was launched by the web server. When used with the web server, it works well. Unfortunately, when launched with the command line, PHP crashes when drush calls mysqli_fetch_array and/or mysqli_fetch_object while everything is fine when calling mysqli_fetch_row... I am using EasyPHP 5.2.10 under windows.
Error message: an unhandled win32 exception occurred in php.exe [5772]. Just-In_time debugging this exception failed with the following error: No installed debugger has Just-In_time debugging enabled. In Visual Studio, Just-In-Time debugging can be enabled from Tools/Options/Debugging/Just-In-Time.
As requested in the comments, here are the information about PHP and the MySQLi module.
Remark: The Client API library version and the Cient API header version are different. However, they are the same when using the web server phpinfo()... Could this be the problem? It is however a fresh easyPHP install...Oo'.
php -v
PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
php -i
phpinfo()
PHP Version => 5.2.10
System => Windows NT APOLLON 5.1 build 2600
Build Date => Jun 17 2009 16:16:01
Configure Command => cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap
_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared
" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"
Server API => Command Line Interface
Virtual Directory Support => enabled
Configuration File (php.ini) Path => C:\WINDOWS
Loaded Configuration File => C:\Program Files\EasyPHP5.2.10\www\drush\php.ini
Scan this dir for additional .ini files => (none)
additional .ini files parsed => (none)
PHP API => 20041225
PHP Extension => 20060613
Zend Extension => 220060519
Debug Build => no
Thread Safety => enabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => php, file, data, http, ftp, compress.zlib
Registered Stream Socket Transports => tcp, udp
Registered Stream Filters => convert.iconv., string.rot13, string.toupper, string.tolower, string.strip_tags, convert., consumed, zlib.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
Configuration
PHP Core
Directive => Local Value => Master Value
allow_call_time_pass_reference => Off => Off
allow_url_fopen => On => On
allow_url_include => Off => Off
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
asp_tags => Off => Off
auto_append_file => no value => no value
auto_globals_jit => On => On
auto_prepend_file => no value => no value
browscap => no value => no value
default_charset => no value => no value
default_mimetype => text/html => text/html
define_syslog_variables => Off => Off
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => STDOUT => STDOUT
display_startup_errors => On => On
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => On => On
error_append_string => no value => no value
error_log => no value => no value
error_prepend_string => no value => no value
error_reporting => 6143 => 6143
expose_php => On => On
extension_dir => C:\Program Files\EasyPHP5.2.10\php\ext\ => C:\Program Files\EasyPHP5.2.10\php\ext\
file_uploads => On => On
highlight.bg => #FFFFFF => #FFFFFF
highlight.comment => #FF8000 => #FF8000
highlight.default => #0000BB => #0000BB
highlight.html => #000000 => #000000
highlight.keyword => #007700 => #007700
highlight.string => #DD0000 => #DD0000
html_errors => Off => Off
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => On
include_path => .;C:\php5\pear => .;C:\php5\pear
log_errors => On => On
log_errors_max_len => 1024 => 1024
magic_quotes_gpc => Off => Off
magic_quotes_runtime => Off => Off
magic_quotes_sybase => Off => Off
mail.force_extra_parameters => no value => no value
max_execution_time => 0 => 0
max_input_nesting_level => 64 => 64
max_input_time => -1 => -1
memory_limit => 128M => 128M
open_basedir => no value => no value
output_buffering => 0 => 0
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 14 => 14
realpath_cache_size => 16K => 16K
realpath_cache_ttl => 120 => 120
register_argc_argv => On => On
register_globals => Off => Off
register_long_arrays => Off => Off
report_memleaks => On => On
report_zend_debug => Off => Off
safe_mode => Off => Off
safe_mode_exec_dir => no value => no value
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sendmail_from => no value => no value
sendmail_path => no value => no value
serialize_precision => 100 => 100
short_open_tag => Off => Off
SMTP => localhost => localhost
smtp_port => 25 => 25
sql.safe_mode => Off => Off
track_errors => On => On
unserialize_callback_func => no value => no value
upload_max_filesize => 2M => 2M
upload_tmp_dir => ${path}\tmp\ => ${path}\tmp\
user_dir => no value => no value
variables_order => GPCS => GPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
y2k_compliance => On => On
zend.ze1_compatibility_mode => Off => Off
[Skipped]
mysqli
MysqlI Support => enabled
Client API library version => 5.1.42
Client API header version => 5.0.51a
MYSQLI_SOCKET => /tmp/mysql.sock
Directive => Local Value => Master Value
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.reconnect => Off => Off
Any idea?
Regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能是扩展兼容性问题。该模块未针对您的 PHP 版本进行编译,或者已损坏/丢失。
当命令行 PHP 解释器找不到正确的扩展目录时,我在其他 LAMP 堆栈中看到过这种情况。
Probably an extension compatibility problem. Either the module was not compiled for your version of PHP or it's corrupt/missing.
I've seen this happen with other LAMP stacks when the command-line PHP interpreter isn't finding the correct extension directory.
感谢您的所有评论和答案,我终于找到了我的问题,使我走上了正轨。 MyQSLi 的版本在使用 Web 服务器时可以,但在命令行上却不行。我在按照建议执行 php -i 时注意到了这一点。因此,要解决此问题,您应该 在此处下载文件并将它们放入您的 PHP \EXT 目录以替换旧的文件。
此致。
I finally found my problem thanks to all your comments and answers that put me on the right track. The version of MyQSLi was ok when working with the web server but not with the command line. I noticed this when doing php -i as suggested. So, to correct this problem, you should download the files here and put them in your PHP \EXT directory to replace the old ones.
Best regards.