PHP在等待任何输出问题之前等待脚本完成

时间:2017-02-15 18:45:14

标签: php vps

最近......

我的VPS有一个自动更新,这搞砸了我的PHP脚本上次运行的方式。上次,我甚至不需要使用ob_flush或任何输出缓冲相关的解决方案来在脚本完成之前查看我的输出。它只是简单地工作。

  

这是自动软件更新:

    The following software were updated during Automatic Cron Updates:
    phpList 3.3.1 - Successful
    poMMo 16.1 - Successful
  

更新的日志如下:

WordPress
Current Version is Latest Version......Continuing

Joomla 2.5
Current Version is Latest Version......Continuing

AbanteCart
Current Version is Latest Version......Continuing

PrestaShop
Current Version is Latest Version......Continuing

Joomla
Current Version is Latest Version......Continuing

Drupal 7
Current Version is Latest Version......Continuing

phpBB
Current Version is Latest Version......Continuing

SMF
Current Version is Latest Version......Continuing

Magento 1.9
Current Version is Latest Version......Continuing

WHMCS
Current Version is Latest Version......Continuing

MyBB
Current Version is Latest Version......Continuing

Gallery
Current Version is Latest Version......Continuing

Open Blog
Current Version is Latest Version......Continuing

Piwigo
Current Version is Latest Version......Continuing

AEF
Current Version is Latest Version......Continuing

osTicket
Current Version is Latest Version......Continuing

phpList
Versions dont match.....Needs Update
Fetching Latest File......Saved the Latest File
Mirror : s4.softaculous.com
Unzipping the files......Unzipped Successfully
Deleting previous files......Done

Zikula
Current Version is Latest Version......Continuing

kPlaylist
Current Version is Latest Version......Continuing

poMMo
Versions dont match.....Needs Update
Fetching Latest File......Saved the Latest File
Mirror : s2.softaculous.com
Unzipping the files......Unzipped Successfully
Deleting previous files......Done

HESK
Current Version is Latest Version......Continuing

Serendipity
Current Version is Latest Version......Continuing

Dotclear
Current Version is Latest Version......Continuing

Mibew Messenger
Current Version is Latest Version......Continuing

Drupal 6
Current Version is Latest Version......Continuing

Revive Adserver
Current Version is Latest Version......Continuing

WebCalendar
Current Version is Latest Version......Continuing

DokuWiki
Current Version is Latest Version......Continuing

Podcast Generator
Current Version is Latest Version......Continuing

SquirrelMail
Current Version is Latest Version......Continuing

BlackNova Traders
Current Version is Latest Version......Continuing

PunBB
Current Version is Latest Version......Continuing

WeBid
Current Version is Latest Version......Continuing

Help Center Live
Current Version is Latest Version......Continuing

Shadows Rising
Current Version is Latest Version......Continuing

Claroline
Current Version is Latest Version......Continuing

PHPfileNavigator
Current Version is Latest Version......Continuing

Geeklog
Current Version is Latest Version......Continuing

dotProject
Current Version is Latest Version......Continuing

phpOnline
Current Version is Latest Version......Continuing

Advanced Guestbook
Current Version is Latest Version......Continuing

Multiplayer Checkers
Current Version is Latest Version......Continuing

phpLD
Current Version is Latest Version......Continuing

Webinsta Maillist
Current Version is Latest Version......Continuing

Lazarus
Current Version is Latest Version......Continuing

ccMail
Current Version is Latest Version......Continuing

Booked
Current Version is Latest Version......Continuing

LittlePoll
Current Version is Latest Version......Continuing

Moodle 2.6
Current Version is Latest Version......Continuing

Sales Syntax
Current Version is Latest Version......Continuing

BellaBook
Current Version is Latest Version......Continuing

PmWiki
Current Version is Latest Version......Continuing

Mautic
Current Version is Latest Version......Continuing

phpESP
Current Version is Latest Version......Continuing

Word Search Puzzle
Current Version is Latest Version......Continuing

phpBook
Current Version is Latest Version......Continuing

phpicalendar
Current Version is Latest Version......Continuing

Aardvark Topsites
Current Version is Latest Version......Continuing

Impleo
Current Version is Latest Version......Continuing

VX Guestbook
Current Version is Latest Version......Continuing

ExoPHPDesk
Current Version is Latest Version......Continuing

RicarGBooK
Current Version is Latest Version......Continuing

Raphael
Current Version is Latest Version......Continuing

Rico
Current Version is Latest Version......Continuing

Trac
Current Version is Latest Version......Continuing

所以我去了我的PHP ini并检查我的值是否改变了,我相信他们做了,所以我改变了我的max_exec时间,内存限制,output_buffering关闭等等。脚本仍然等待所有事情在它之前完成输出什么。所以我决定在我的脚本中开始使用flush。我启动了一个测试脚本并编写了以下内容:

<?php 
    header( 'Content-type: text/html; charset=utf-8' );
    ini_set('max_execution_time' ,0); 
    ini_set('set_memory_limit', -1);
    ini_set('output_buffering', 'Off');
    set_time_limit(0);
    while (ob_get_level()) ob_end_clean();
    ob_end_clean();
    ob_implicit_flush();
    ob_end_flush();
    ob_end_clean();
    echo 'Hello';
    ob_flush();
    flush();
    sleep(5);
    echo 'World!';
    ob_flush();
    flush();
 ?>

我使用书中的每个解决方案来尝试修复它并猜猜是什么......? 它仍然等待5秒才能说出Hello World而不是说Hello,等待5秒然后输出世界。

PHP版本:5.6.30

我喜欢通过浏览器访问我的PHP脚本,但我可能会被迫使用CLI,因为它不起作用。

该死的,我只是将我的PHP.ini文件粘贴到任何PHP技术向导中,可能会找到一个问题。

http://pastebin.com/cm1gjt9W
编辑:所以我暂停了CloudFlare,然后又恢复了......现在它正常工作。我不明白。

0 个答案:

没有答案