Re: Question about apache-php concurrent process control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As I know, apache-php works this way. When the web server gets an http request with file name extension ".php", it will start the php interpreter to process the php file.

Now I have a php program does something like this: when it is executing with one parameter p1, the program code goes to contact a database, gets back huge amount of data, writes it to file system. This will take pretty long time to finish. In the mean time, the same php code will be invoked by apache with another request, passing different parameter p2, indicates the code need to run to check the availability and read partial of the data which has already writen to the file system just now. The program location need to be in the same URL, but with only different parameter passing to it.

for example:

http://baseURL/a.php?v=p1
http://baseURL/a.php?v=p2

I want these 2 process can be run concurrently, but through a small test, I found out that they just sequentially execute one after the other.

http://baseURL/a.php
http://baseURL/b.php

howevery can run concurrently well, it means that apache can invoke multiple php interpreter processes. But I do not know how to make php interpreter to do the same thing. Or 2 php interpreter processes process one php program sepreately without interfer with each other.

Hope I have explained myself clearly.
Thank you.



From: Rasmus Lerdorf <rasmus@xxxxxxxxxxx>
To: Liang <little00wofl@xxxxxxxxxxx>
CC: php-general@xxxxxxxxxxxxx
Subject: Re:  Question about apache-php concurrent process control
Date: Fri, 15 Jul 2005 13:46:37 -0700

Liang wrote:
>  I am a programmer and new to php. I wonder what process control can php
> interpreter do for multithreading . I notice that through http request, php
> interpreter can execute 2 php programs simataneously, but will only
> sequentially queued and execute if I try to execute one php code in the same
> time.
>
> Can somebody tell me is it a problem by php design not to be execute code
> concurrently, or some apache/php configuration problem where I can fix?

Apache is a multi-process single-threaded architecture.  1 request, 1
process.  Concurrent requests are handled by concurrent processes.  What
is it you think you need a second thread for during a request?

-Rasmus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux