関数で非常に長いループを実行していますが、最終的な反復をすべて終了せず、エラーを発生させずに停止します:
function my_function(){
    foreach (range(100,999) as $art_id){ 
        
    
    $current++;//see bottom flush functions...
    outputProgress($current, $art_id );//see bottom flush functions...
// do a lot of stuff on remote URL...
    // including download images , 
    // scraping HTMl etc ..
    
    }
}
進行状況を追跡するために、フラッシュでいくつかの出力進行状況を使用しています
function outputProgress($current, $total) {
    // echo "<span style='background:red;font-size:1.5em;color:#fff;'>" . round($current / $total * 100) . "% </span>";
    echo "<span style='background:red;font-size:1.5em;color:#fff;'>" . $current .'/'. $total  . "% </span>";
    myFlush();
    sleep(1);
}
と
function myFlush() {
    echo(str_repeat(' ', 256));
    if (@ob_get_contents()) {
        @ob_end_flush();
    }
    flush();
}
(パーセンテージ計算は気にしないでください。現在は無効になっており、反復の ID のみが表示されます)
ほとんどの場合、ループを実行していることに気付きました.20〜25回の反復後に停止します。時には10ほど。
私の最初の容疑者はtime limit、およびmax_execution timeだったので、追加しました:
set_time_limit(99999);
ini_set('max_execution_time', 99999);
function my_function(){
    foreach (range(410,499) as $art_id){ // done 500-600
    set_time_limit(99999);
    ini_set('max_execution_time', 99999);
    
    // do a lot of stuff on remote URL...
    // including download images , 
    // scraping HTMl etc ..
    }
}
ご覧のとおり、念のため、これらの両方INSIDEとOUTSIDE関数自体を追加しました。
しかし、それはあまり役に立たず、ループは停止します。私の次の容疑者は だったMemory limitので、追加しました:
ini_set('memory_limit','128M');
私はwpに取り組んでいるので、私も試しました
define('WP_MEMORY_LIMIT', '128M'); 
しかし、役に立たない。少し繰り返した後でも、scipt は停止します。
- この動作の他の考えられる原因と考えられる解決策は何ですか?
 
注意してください-スクリプトはエラーを出しません。特定のループで停止するだけです。
編集私
スクリプトをここに貼り付けました 。これは実際には、simplehtmldom lib に含まれるサンプルからわずかに変更された Scrap_slashdot() 関数です。
画像をダウンロードして添付しながらWordPressの投稿を挿入するように修正されています。
編集 II 
@Allendar コメントを使用echo ini_get('memory_limit');すると機能するようで、128M に設定されています。