kranthi, you are wrong here. popen() will open a pipe to a process. You must have meant fopen() which doesnt work with pipes, but with files. you first popen php (ie execute it) you then write the code you want php to exec (php is still executing, reading your input) at the end you pclose php and then it is executed But this, while still using 2 threads (ie the original webserver thread, and the popen("php"...) will not be multitasking, why? Because the first thread is writing to the second one. You will need to look into threading functions to get a multi-threaded program. But a simpler approach is to execute something in the background like this: system("someprog &") This works on linux at least. System will return immediately with success (you will never be able to catch someprog's return). But being a completely separate process, there wont be any communication possible naturally, you would have to implement inter-process communication (IPC)... but the simplest approach would probably be: 1) webserver receives client request and data 2) webserver writes data on file, ready to be worked on by the bg thread. 3) webserver calls system("somebgprog &") 4) somebgprog starts executing and checks the content of predetermined file and starts working on it. It could report its status into another file (which can be read by the server). A simple way to make this "somebgprog" is using php... you build your CLI-PHP script and then call system("php /path/to/bgscript.php &") One problem to think about in advance: What happens if you have many of these queries at the same time? eh, you'll get many threads working at the same time in bg... this could lead to issues... Good luck! On Tue, May 26, 2009 at 4:55 AM, kranthi<kranthi117@xxxxxxxxx> wrote: > popen will allow you to read/write data to a file but not execute the php code. > > i am assuming that you want to execute the php script like > include/require does.. if that is the case system() will serve your > purpose....but this requires php to be installed as a CLI > <?php > $res = system("path/to/php.exe /path/to/second/file.php"); > ?> > > but as Nathan suggested it would be best for you if you considered > alternative options. for example you can make an AJAX request to the > second file. > Kranthi. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php