Results 1 to 7 of 7
  1. #1

    Real-time progress showing, without java

    Hi everyone...

    I have a maintenance and cache generating php script that take quite a while to complete and I got to wishing it would show where it stands on a real time basis. It already output progress log like "generation of these pages .... Done" kinda line. Problem is with PHP, you get to wait until the page (and so, the script) is complete before showing anything... so you get the whole report, but only at the end.

    I did some thinking and thought that I could make the script into a shell script to be executed in the background, called with shell_exec(), outputing a text file and on the web, creating a page that refreshes every second and that would load that text file, effectively showing where the maintenance stands... but that seems like overkill to do it like this, right ?

    Is there a better way to do this ? a easy way ? anyone, any insight ?

    keep in mind I cannot have it use any client-side technology like JAVA.

    Thanks all!

  2. #2
    Join Date
    Mar 2003

  3. #3
    Join Date
    Jul 2006
    you may find this helpfull also
    cPanel, CloudLinux, Softaculous ℵ Off Site Backups, Redundant DNS

  4. #4
    Actually, anlene, the result i'm trying to achieve is more or less the opposite of that... I don't want to buffer the result until the end an send at that point (or not) but rather, I want the script progress to be shown like you would, say, a shell script.

    Thanks anyways for the answer

  5. #5
    Join Date
    Aug 2001
    Have a look at the flush() function. - Is your site up?
    Multi-Location Service Availability Check ● yes, we do HTTPS & IDN!

  6. #6
    Join Date
    Aug 2002
    Nothing PHP can do, can guarantee results in realtime, especially output buffering. Your best recourse is to use AJAX and setup a polling routine - ie; check status every half second and report it if it has changed.

    I would recommend building a PHP proxy to the process, and using from to get the job done.

    Good luck.
    circlical - hosting software development
    forums * blog

  7. #7
    Join Date
    Feb 2003
    L.A. C.A.
    If you have root access on your machine you can put your php scripts in /etc/cron.daily or /etc/cron.hourly or even set up your own customized cron event.

    Upon using this method make sure you define the PHP path as you would in perl, something like: #!/usr/local/php/bin

    I have a Cron event that uses PHP to update all my awStats pages statically, it then reports the total running time (in seconds) and even reports the CPU usage at the time.

    I can help you with this is you post further what you need.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts