Variable scope: Passing a pipe between AJAX scripts.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
conartist6
Forum Newbie
Posts: 2
Joined: Fri Jul 09, 2010 2:18 pm

Variable scope: Passing a pipe between AJAX scripts.

Post by conartist6 »

I have a bit of an awkward situation. I want php to monitor the output of a running shell script in real time. For this to work, AJAX is obviously required, or else I would get no output until the entire bash script was finished running (useless since the point of the application is to interact with the script). My problem is that the application needs to be started by a main script, and then accessed by the response script for the AJAX request. Is there any form of variable scope in PHP that will allow me to pass something other than string data from one PHP script to another? If I can't find anything I'll have to resort to using screen outside of PHP in order to keep the process running and then every time I need an update screen will have to connect to the running process, read from it, then disconnect again, and that just seems terribly messy. Can PHP pass pointers between scripts?

-conartist6
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Variable scope: Passing a pipe between AJAX scripts.

Post by requinix »

Nope, can't pass file handles between scripts.

If you want to monitor output, have the process dump to a file and make your script read from that... unless there's a specific way to communicate with the process and get information, in which case you should use that.
conartist6
Forum Newbie
Posts: 2
Joined: Fri Jul 09, 2010 2:18 pm

Re: Variable scope: Passing a pipe between AJAX scripts.

Post by conartist6 »

Ok, thats what I need to know. Thanks. Perhaps I'll take this over to C...
Post Reply