I see a lot of people asking on how to use a fork to run a php script or web page in the background.
Here’s a quick script I created using linux’s wget to run another process in the background. You could use this to automatically upload something to another server, or just about anything that needs to happen after a user action.
Note: you must have exec enabled for this to work. This is a security risk, so make sure you know the potential damage that can be done by enabling exec, and by the script that you are running. Make absolutely sure to sanitize any input being transferred to the executed script.
In my case, I needed to initiate a file upload to a remote server after a certain action was taken. Because of the nature of the upload, it would have taken about 30 seconds before displaying any response to my user, which is an unacceptable delay.
First, make the script that needs to run in the background.
This is an updated version of the script. It now resides on only a single page and should be less confusing to put into a website. Please feel free to use this script as a base and customize as you like.
Sign up for a business site search account here: http://www.google.com/sitesearch/index.html
The internet is abuzz with news of Google’s new business custom search engine. Google is allowing business sites to have their own custom search engine for $100 per year (<5,000 pages) or $500 per year (up to 50,000) pages. This includes some cool reporting and an XML API so that you can customize to your heart’s content.
The following is a very simple php & html script that you can use for your own Google business search engine. It was made for a php5 server as it uses the built-in simpleXML class. Upload this to your website, enter your account id, and make a form to post to it. That’s it!