简体   繁体   中英

php script stops with no errors

I use WAMP on my local pc and I'm running a php script that performs a large loop that call a recursive function.

I defined all of the timeout and memory parameters in the php.ini and my.ini, but my script always stoped after a number of iterations with no errors.

I tried:

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); 

I also tried flush options, but it only got me a few more iterations.

I checked if it's a timeout problem, but I add a sleep(1) before executing the recursive function and the script stoped after the same loop iterations.

On my server I didn't have that problem, but I cann't run this script on the server because it consumed a lot of memory after some time. My pc php version is 5.5.12 and on my server is 5.4

phpinfo xdebug section:

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

Try

ini_set('display_errors', 1);

instead of

ini_set('display_errors', E_ALL);

If I understand you good, your goal is to run script until it's done:

ini_set('max_execution_time', 0);//no time limit

Or you can do the same thing with:

set_time_limit(0);

Also restart wamp because if you make changes in php.ini file changes will occur after restart.

If it stops after the same amount of iterations, most likely it's XDebug killing the script because the nesting level is too big.
Please double check its settings inside your php.ini file, option xdebug.max_nesting_level

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM