So, we need to say is something to the effect of:

    The max_execution_time directive and set_time_limit function act to
limit
    the amount of time that a PHP script is allowed to execute. This is not
    necessarily the same as the amount of time that the script is allowed to
    run. If the script is running, but not actually executing, then the time
    spend doing this is not counted towards the maximum execution time.

    Cases where this occurs include sleep, usleep and any of the program
    execution functions (exec, system, etc...).

    For example:

    <?php
        set_time_limit (1);

        /*
            Recursively read the file system from the root down
            ... should take more than a second ;)
        */
        print exec ('for file in `ls -R /`; do echo $file; done') . "<br>";

        /* Read the current directory listings */
        print exec ('for file in `ls .`; do echo $file; done') . "<br>";

        print 'Before call to sleep. <br>';
        flush ();
        sleep (1);

        print 'After call to sleep. <br>';

        for ($x=0; $x < 1000000; ++$x) ;
        echo "Foo!";
    ?>

    Despite the time limit imposed by set_time_limit, both calls to exec and
    the call to sleep should complete. However, the script will fail with a
    maximum execution time exceeded warning about the script during the for
    loop.

I know that this is a bit rough - does anyone have anything to add to
clarify
it?

--zak


Zeev wrote:
> Right - as I said, the executed program will go on running, whereas the
> script will terminate...
>
> At 01:44 16/1/2001, Zak Greant wrote:
> >Zeev Suraski wrote:
> > > BTW, offhand, I'm not sure that it's really not working.  The time
limit
> > > should still be imposed (at least under UNIX, not under Windows).
> >However,
> > > the executed program will go on running.
> >
> >     I did a very basic test:
> >
> >     <?php
> >         set_time_limit (1);
> >
> >         print exec ('for file in `ls -R /`; do echo $file; done');
> >
> >         for ($x=0; $x < 1000000; ++$x) ;
> >         echo "Foo!";
> >     ?>
> >
> >     The script runs, exiting with this message:
> >         /var/yp/binding
> >         Fatal error: Maximum execution time of 1 second exceeded in
> >/home/zak/public_html/stl.php on line 6
> >
> >     It looks like the time limit does not apply to the executed
program...
> >
> >     --zak
> >
> > >
> > > Zeev
> > >
> > > At 07:17 15/1/2001, Zak Greant wrote:
> > > >A recent note added to the manual errata pointed out the
> > > >set_time_limit does not affect system commands that have
> > > >been executed by PHP.
> > > >
> > > >I would guess that attempting to limit system behavior in
> > > >this way is beyond the scope of set_time_limit.
> > > >
> > > >Any opinions or options on this issue?  My feeling is that
> > > >we document that set_time_limit is not a safe way to limit
> > > >the resource usage of commands run via calls to exec, etc...
> > > >
> > > >--zak
> > > >
> > > >
> > > >
> > > >--
> > > >PHP Development Mailing List <http://www.php.net/>
> > > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > >For additional commands, e-mail: [EMAIL PROTECTED]
> > > >To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
> > > --
> > > Zeev Suraski <[EMAIL PROTECTED]>
> > > CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
> > >
> > >
> > > --
> > > PHP Development Mailing List <http://www.php.net/>
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
>
> --
> Zeev Suraski <[EMAIL PROTECTED]>
> CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to