1

In my application, I am running a shell script but till the script completes executing the screen is blank. I am not able to display anything on screen. I want to display the log file to the user so till the log file is generated, i want the user to see some text content on the screen.

I read previous questions posted where they say multithreading in php is not possible.

Is there a way i can do this?

Neha
  • 75
  • 1
  • 5

3 Answers3

2

These two questions might be of some help:

1> exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile));

php execute a background process

2> ignore_user_abort(true)

Community
  • 1
  • 1
zengr
  • 38,346
  • 37
  • 130
  • 192
1

I would use jQuery.

Call the page loading the php script from the main page.

Mainpage

  • Basic html page with a $(document).ready() loading the script.php page using jQuery.get()
  • At initial state, a div contains some text.
  • When success is called, load content in same div.

Link to jQuery.get() : http://api.jquery.com/jQuery.get/

oimoim
  • 449
  • 2
  • 9
  • 20
0

These questions suggest it is and isn't possible, depending on whose answer your looking at; Multithreading in PHP

How can one use multi threading in PHP applications

You should take a look at; http://joseph.randomnetworks.com/2005/10/21/fake-fork-in-php/

Community
  • 1
  • 1
imbadatjquery
  • 87
  • 1
  • 1
  • 6