Forum Moderators: coopster

Message Too Old, No Replies

php multi-threading and scheduler

         

hitman001

9:13 pm on Dec 12, 2005 (gmt 0)

10+ Year Member



Hello everyone,

I'm new to this forum and I was hoping I could get some help.

I need to run a php script in the backgroud. Basically when the user hits a button, I have to run a complicated scripts which generates pdf file with images, which takes a bit of time and I dont want the user to wait till its done. Is there any way to do this by executing another script. The problem could be that I dont have direct access to the server, I using one of those shared servers so I might be limited.

Also, I'm trying to make a mechanisim which will execute a php script one a week and again I can run any server scripts because I dont have access to the server. My solution was to do it based on event such as a login but again I dont want the user to wait everytime he/she logs in for that script to run.

Thanks.

dreamcatcher

3:37 am on Dec 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hitman001, welcome to Webmaster World. :)

Have you looked into cron jobs?

dc

LeChuck

6:09 am on Dec 13, 2005 (gmt 0)

10+ Year Member



how about

exec("nameofyourapp -options &");

eg

exec("/usr/bin/php pdfgenerate.php &");

or maybe

exec("nohup /usr/bin/php pdfgenerate.php");

(wild guess)

hitman001

2:20 pm on Dec 13, 2005 (gmt 0)

10+ Year Member



I did look into cron but as I understand in order for me to use it I need to install some libraries and I dont have access for that.

Regarding the exec(), I tried it doesnt seem to work or maybe I'm doing something wrong.

I'm also thinking of using AJAX for running a backgroud app.