SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    St Petersburg, Russia
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    exec - running program in background

    it is required to run a programm in the background under windows and continue executing php-script (i.e. the command exec (shell_exec, etc) should not wait for the program to finish). alternatively, it would be ok to run the program in the background and redirect its output to the browser. currently, the webpage keeps loading for 30 sec. and then shows a "maximum execution time exceeded" error.

    I tried:

    exec("program.exe");
    exec("program.exe >null");
    exec("cmd.exe /c program.exe");

    shell_exec("program.exe");
    shell_exec("program.exe >null");
    shell_exec("cmd.exe /c program.exe");

    passthru("program.exe");

    but non of the above helps

  2. #2
    SitePoint Addict
    Join Date
    May 2005
    Location
    London, ON
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to change your max_execution_time in the php.ini file (default is 30 seconds). You can also change it using this command:

    PHP Code:
    ini_set(max_execution_time10000); 
    where 10 000 is the new number of seconds to wait until it fails.
    Ryan Price
    Subscribe to my blog for regular tips and tricks

  3. #3
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    St Petersburg, Russia
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jeanco View Post
    You need to change your max_execution_time in the php.ini file (default is 30 seconds). You can also change it using this command:

    PHP Code:
    ini_set(max_execution_time10000); 
    where 10 000 is the new number of seconds to wait until it fails.
    Thx. I don't need to change execution time limit. The script should start the program and continue to execute without waiting for the program to finish as I described in the original post.


Bookmarks

Posting Permissions

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