views:

76

answers:

2

I have a PHP page that gets its content by making an HTTP request to another site on the same server, using file_get_contents. Both sites run in Apache 2 which calls PHP using suPHP (which is FastCGI, right?)

How significant is the overhead of this call? Does Apache do a lot of processing before sending a request to PHP?

An alternative way to make the call would be for the first site to exec('php /the/other/script.php some parameters'). Would this be faster, or is the overhead of spawning a process bigger than that of going through Apache?

A: 

Unfotunatly installing PHP as cgi, you will loose alot of performace, because eachtime you have to create a new process for it. So best method is to install PHP as apache modul

streetparade
The choice of PHP connection (in our case suPHP) is not the question here, but thanks anyway
Bart van Heukelom
+1  A: 

Apache's over head is going to depend on whats configured for that site host, for example https, htaccess checks, rewriting, etc.. Those things can stack up. Now i dont think it would be much strain overhead wise comparatively but you are going to have the time it taks to generate the response which depending on the nature of the external pages oyure calling could be signifigant in some situations.

With that said, i dont nessecarily see a problem with making the calls through apache. But i do think that as you suggest exposing the php directly would be better. I think maybe reading up on SOA in general might help you gain some insight on how best to implement.

prodigitalson