Re: Problem with EXEC and PASSTHRU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



http://php.net/flush may be of interest.


On Wed, October 25, 2006 2:35 am, Matt Beechey wrote:
> I am writing a php website for users to edit a global whitelist for
> Spam
> Assassin - all is going fairly well considering I hadn't ever used php
> until
> a couple of days ago. My problem is I need to restart AMAVISD-NEW
> after the
> user saves the changes. I've acheived this using SUDO and giving the
> www-data users the rights to SUDO amavisd-new. My problem is simply a
> user
> friendlyness issue - below is the code I'm running -
>
> if(isset($_POST["SAVE"]))
> {
> file_put_contents("/etc/spamassassin/whitelist.cf",
> $_SESSION[whitelist]);
> $_SESSION[count]=0;
> echo "Restarting the service.........</A></P>";
> exec('sudo /usr/sbin/amavisd-new reload');
> echo "Service was restarted...... Returning to the main page.";
> sleep(4)
> echo '<meta http-equiv="refresh" content="0;URL=index.php">';
> }
>
> The problem is that the Restarting the Service dialogue doesn't get
> displayed until AFTER the Service Restarts even though it appears
> before the
> shell_exec command. I've tried exec and passthru and its always the
> same - I
> want it to display the "Service was restarted" - wait for 4 seconds
> and then
> redirect to the main page. Instead nothing happens on screen for the
> browser
> user until the service has restarted at which point they are returned
> to
> index.php - its as if the exec and the sleep and the refresh to
> index.php
> are all kind of running concurently.
>
> Can someone PLEASE tell me what I'm doing wrong - or shed light on how
> I
> should do this.
>
> Thanks,
>
> Matt
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux