Solved

Forking not speeding anything up?????

Posted on 2003-11-06
2
213 Views
Last Modified: 2008-03-06
i am forking a call to another php script becuase it must connect to a mail server.  It can take up to a minute to send depending on attachments and network traffic and other factors.

here is the code i am using to call the scrip that does the email functions

exec("start c:\php\php d:\web_projects\ltrak\wwwroot\forked.php > NUL &");

When i call the script this way, it still waits for  the exec to return so it does not speed anything up.  I thought forking was meant to start a new process so that the current one can continue on with what it is doing.

Any ideas?

platform is win2k pro php 4.3.3 iis5
0
Comment
Question by:lazyelm
2 Comments
 
LVL 6

Expert Comment

by:aolXFT
ID: 9695649
try calling a program that returns before it is actually finished sending the mail.

The program would spawn another process, return and let the child process do the work.

It would probably have to be written in C/C++

Alternatively you could cache the necessary mails to be sent, and use the Windows Equivlent of a Cron job EG wincron.
0
 
LVL 8

Accepted Solution

by:
inq123 earned 500 total points
ID: 9698315
Hi lazyelm,

My guess is that you would also need to redirect STDERR, e.g.:

exec("start c:\php\php d:\web_projects\ltrak\wwwroot\forked.php > NUL 2>NUL &");

Cheers!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now