Process to background

Category: PHP - Editors

This is a PHP 5 class that sends a specified php file, dynamically generated php code, or any system call to a background process on linux/unix servers (a little modification to the forkToStream method would make it run on windows) and returns a filename that will contian that processe's output. In addition, if you use the forkPHPFile or forkPHPCode methods, the forked script will have access to the output file's name in its first $argv.This is helpful for starting scripts or programs that take a long time to execute and that you do not want to have the user wait for. Since all the fork* methods return immediately, php can continue to generate the page while the time-consuming process runs on another thread on the server. It can also start a bunch of little processes going - for instance I wrote it to simultaneously make a bunch of connections to remote systems instead of waiting for it to retieve the data from each, one at a time.Tips:-pass false to the constructor to have all the output files deleted at the end of your script's execution.-If you want to start many processes simultaneously but none of them will take long to finish, you can use the php's sleep() function to check their output every second until they're all done.-Since your php scripts know the name of their output file (its the first command-line argument variable), you can re-write their contents (i.e. 27% turns to 28%...) and then just output the % done whenever the user refreshes (you'd have to store the output filename in a session variable). Date: 16 February, 2012


Process Background - Process Snippets - Php Snippets - Process - Background - Php

Homepage: http://www.phpbuilder.com

Developer: phpbuilder.com

License: Artistic License, GNU General Public License (GPL)

Operating System: Windows, Linux, Mac OS, BSD, Solaris

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

Virtual FTP for a WebSite allows you to manage a website via FTP.

developer Developer: phpbuilder.com
license License: Freeware
operating systems Operating System: All


This will receive the path to a PDF as a command line argument, generate multiple thumbnails at various sizes, then ftp them to various locations.

developer Developer: phpbuilder.com
license License: Freeware
operating systems Operating System: All


PHP FTP Client and Library script provides you a class to wrap most of the standard FTP functions supplied by PHP, as well as a client to use the libraries.

developer Developer: phpbuilder.com
license License: Freeware
operating systems Operating System: All


net2ftp is a web based FTP client.

developer Developer: phpbuilder.com
license License: Freeware
operating systems Operating System: All


FTP Upload With CURL demonstrates how to upload files to an FTP server using the PHP support for libcurl.

developer Developer: phpbuilder.com
license License: Freeware
operating systems Operating System: All


php_ftp_class is a class that connects to a FTP server to work with files and directores.

developer Developer: phpbuilder.com
license License: Freeware
operating systems Operating System: All


ProgressBar.

developer Developer: bongard.net
license License: Freeware
operating systems Operating System: All


Dynamic Cascading Menu Tree is a one base function for calling menu information from a db and buildingion for conal cascading menu tree from it.

developer Developer: phpbuilder.com
license License: Artistic License, GNU General Public License (GPL)
operating systems Operating System: Windows, Linux, Mac OS, BSD, Solaris


This function uses regular expressions to take HTML input and output it as easy-to-read syntax highlighted code.

developer Developer: phpbuilder.com
license License: Artistic License, GNU General Public License (GPL)
operating systems Operating System: Windows, Linux, BSD