【发布时间】:2015-01-19 16:34:10
【问题描述】:
我在本地电脑上使用 WAMP,并且正在运行一个执行大循环的 php 脚本 调用递归函数。
我在 php.ini 和 my.ini 中定义了所有的超时和内存参数, 但我的脚本在多次迭代后总是停止,没有错误。
我试过了:
error_reporting(E_ALL);
ini_set('display_errors', E_ALL);
ini_set('default_socket_timeout', -1);
ini_set('max_execution_time', -1);
ini_set('memory_limit', -1);
ini_set('mysql.connect_timeout', -1);
set_time_limit(0);
ignore_user_abort(true);
我也尝试了刷新选项,但它只让我多迭代了几次。
我检查了是否是超时问题,但我在执行递归函数之前添加了一个 sleep(1),并且脚本在相同的循环迭代后停止。
在我的服务器上我没有这个问题,但我无法在服务器上运行这个脚本,因为一段时间后它消耗了大量内存。 我的 pc php 版本是 5.5.12,我的服务器上是 5.4
phpinfo xdebug 部分:
xdebug
xdebug support enabled
Version 2.2.6
IDE Key GUY-LI-LT$
Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $
Directive Local Value Master Value
xdebug.auto_trace Off Off
xdebug.cli_color 0 0
xdebug.collect_assignments Off Off
xdebug.collect_includes On On
xdebug.collect_params 0 0
xdebug.collect_return Off Off
xdebug.collect_vars Off Off
xdebug.coverage_enable On On
xdebug.default_enable On On
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.extended_info On On
xdebug.file_link_format no value no value
xdebug.idekey no value no value
xdebug.max_nesting_level 8000 8000
xdebug.overload_var_dump On On
xdebug.profiler_aggregate Off Off
xdebug.profiler_append Off Off
xdebug.profiler_enable Off Off
xdebug.profiler_enable_trigger Off Off
xdebug.profiler_output_dir c:/wamp/tmp c:/wamp/tmp
xdebug.profiler_output_name cachegrind.out.%t.%p cachegrind.out.%t.%p
xdebug.remote_autostart Off Off
xdebug.remote_connect_back Off Off
xdebug.remote_cookie_expire_time 3600 3600
xdebug.remote_enable Off Off
xdebug.remote_handler dbgp dbgp
xdebug.remote_host localhost localhost
xdebug.remote_log no value no value
xdebug.remote_mode req req
xdebug.remote_port 9000 9000
xdebug.scream Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.show_mem_delta Off Off
xdebug.trace_enable_trigger Off Off
xdebug.trace_format 0 0
xdebug.trace_options 0 0
xdebug.trace_output_dir \ \
xdebug.trace_output_name trace.%c trace.%c
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3
【问题讨论】:
-
你在本地启用了 xdebug 吗?
-
您是否测试过在命令行中运行您的脚本?
-
您检查过您的 php.log 文件以了解更多详细信息吗?
-
您好我现在下载了xdebug,但我不知道如何使用它。我没有尝试在命令行中运行脚本,因为我可以在我的服务器上的浏览器中运行它,所以我认为我可以在我的本地电脑上做到这一点。 php.log 没有错误
-
请添加一个带有
<?php phpinfo() ?>的页面并在输出中搜索xdebug。 AFAIK wamp 应该默认安装它。我对可能的原因有预感,但我希望得到确认