Hi All,
I am working on a mailing list program for a client, and I am wondering
what tbe hest way to deal with script timeouts is. I realize that I
could use set_time_limit( ) to increase the script timeout, but that
doesn't handle situations where 1) safe mode is on, or 2) Apache's
timeout is exceeded. These mailings go out to between 5000 and 10000
email addresses, so timeouts are a concern.
It seems to me that the best thing to do would be to fire off a separate
process, perhaps a PHP script that runs directly via the php executable
(a command line script, rather than a .php file that is executed through
Apache).
Is there a way to trigger a process that will then run on its own? The
PHP script running in the browser could then send a message saying
"delivery started" or something, and the separate PHP script that has
been fired would handle the actually delivery. It would run outside of
Apache, and can record success/failure in a database.
Running PHP4.3.9 on RHEL (but I would like a solution that is not tied
to a particular version of PHP or Linux, if possible).
Thoughts?
Sincerely,
-Josh 5 18146
Hi,
I've done a similar solution (in perl though). Have the browser script
update a database/text/config file.
Have a scheduler (cron on unix, at on windows) execute the script that
will do the background work only after checking the value updated by the
browser script and have it clear it after finishing the job.
I had it every 3 hours and used a text file, depends on tipe of job and
you can have it run up to every minute.
Hope to have helped ;-)
Joshua Beall wrote: Hi All,
I am working on a mailing list program for a client, and I am wondering what tbe hest way to deal with script timeouts is. I realize that I could use set_time_limit( ) to increase the script timeout, but that doesn't handle situations where 1) safe mode is on, or 2) Apache's timeout is exceeded. These mailings go out to between 5000 and 10000 email addresses, so timeouts are a concern.
A way to manage the timeout could be to generate a small output say after each
100 mails sent (echo ".";), this would keep the page alive for the apache
server. But, no I don't think this is the best option this time.
It seems to me that the best thing to do would be to fire off a separate process, perhaps a PHP script that runs directly via the php executable (a command line script, rather than a .php file that is executed through Apache).
Is there a way to trigger a process that will then run on its own? The PHP script running in the browser could then send a message saying "delivery started" or something, and the separate PHP script that has been fired would handle the actually delivery. It would run outside of Apache, and can record success/failure in a database.
Running PHP4.3.9 on RHEL (but I would like a solution that is not tied to a particular version of PHP or Linux, if possible).
You could try something like system('php script.php &');
Not sure if that will work in the same way in php as it does in shell.
//Aho
Joshua Beall wrote: Is there a way to trigger a process that will then run on its own? The PHP script running in the browser could then send a message saying "delivery started" or something, and the separate PHP script that has been fired would handle the actually delivery. It would run outside of Apache, and can record success/failure in a database.
Running PHP4.3.9 on RHEL (but I would like a solution that is not tied to a particular version of PHP or Linux, if possible).
The only solutions I know of are:
1) run a daemon process to control the background process and initiate it
from your PHP (rather complicated)
2) start a process which forks and resets it's process group. (afaik
impossible using PHP only)
3) `at now 'php -q background.php' `
HTH
C.
J.O. Aho wrote: You could try something like system('php script.php &'); Not sure if that will work in the same way in php as it does in shell.
It works exactly the same way; although both processes run concurrently, the
parent process will wait for the child to terminate. See post in
alt.comp.lang.p hp
C.
Joshua Beall wrote: Hi All,
I am working on a mailing list program for a client, and I am wondering what tbe hest way to deal with script timeouts is. I realize that I could use set_time_limit( ) to increase the script timeout, but that doesn't handle situations where 1) safe mode is on, or 2) Apache's timeout is exceeded. These mailings go out to between 5000 and 10000 email addresses, so timeouts are a concern.
It seems to me that the best thing to do would be to fire off a separate process, perhaps a PHP script that runs directly via the php executable (a command line script, rather than a .php file that is executed through Apache).
Is there a way to trigger a process that will then run on its own? The PHP script running in the browser could then send a message saying "delivery started" or something, and the separate PHP script that has been fired would handle the actually delivery. It would run outside of Apache, and can record success/failure in a database.
Running PHP4.3.9 on RHEL (but I would like a solution that is not tied to a particular version of PHP or Linux, if possible).
Thoughts?
Sincerely, -Josh
Possibly a cron job running a PHP script that writes and subsequently
reads its own a log file ... containing the settings for the next SQL
query's start row and limit. http://www.phpfreaks.com/tutorials/28/0.php This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sin Jeong-hun |
last post by:
Many applications need to lanch a web browser to show its homepage to
users. I used
System.Diagnosis.Process.Start("http://www.google.com");
Or I launched other application like
System.Diagnosis.Process.Start("notepad.exe");
But the problems is the application freezes for a couple of seconds
till the application starts. Is there any way to start a process
asynchronously, so that my application wouldn't freeze? Should I create
a new...
|
by: HK guy |
last post by:
If i call another process to run, how to run as background.?
Thank you.
|
by: James Radke |
last post by:
Hello,
I have a multithreaded windows NT service application (vb.net 2003) that I
am working on (my first one), which reads a message queue and creates
multiple threads to perform the processing for long running reports. When
the processing is complete it uses crystal reports to load a template file,
populate it, and then export it to a PDF.
It works fine so far....
|
by: henning.friese |
last post by:
Hello NG,
I'm need to write some code which creates tiff files from various
document types (doc, pdf, xls). I want to do this by ShellExecuting
(via System.Diagnostics.Process) the doc-files with the "print"-verb.
This works for me. However, I need to handle the case when a printing
application
doesnt't quit in a given timespan (for example a password-protected
word-document). So I've tried the following:
|
by: JN |
last post by:
Hello,
I am trying to write a program or service that will run in the
background and wait for a particular program to start, when it does I
want something else to occur such as a message box. I am not sure how to
do the waiting game (sleep is no good, neither is a loop).
Any help is appreciated.
JN
| |
by: tshad |
last post by:
I created a service in VS 2003 and the code works fine as an application,
but not as a service.
It installs fine, but when I try to start it, it tells me it was unable to
start.
Am I missing something here?
Here is the program.
|
by: Thirsty Traveler |
last post by:
I would like to create a test harness that simulates multiple concurrent
users executing an individual thread. I would like this to be determined at
runtime when the user specifies the number of desired threads. When this is
kicked off, I would like to wait in the primary thread until all worker
threads have completed and time the result... one problem... I can't figure
out how to wait for all threads to complete prior to updating my...
|
by: bonk |
last post by:
I have an application that needs to perform some background work, i.e.
Logging, wich must not block the main thread. How would I basically
design such a scenario? It is obvious that I should do that on an extra
thread but I think it is a bad idea to spawn a new thread everytime a
log-message is written and let it die once the message was written. But
how do I keep a thread alive and trigger the log-messages and pass the
string to that...
|
by: Anbu |
last post by:
Hi all,
I'm creating processes of a console based application. After
proc.Start() the process is not getting terminated and the thread
keeps waiting for some reponse from the process. Now I need to kill
the process if it takes more time.
Process proc = new Process();
proc.StartInfo.FileName = "application";
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |