PHP and Apache
| From: | Giuseppe D'Ambrosio | Date: | Mon, 04 Sep 2000 15:14:14 +0000 |
| Subject: | PHP and Apache | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-2401@lists.php.net to get a copy of this message | ||
ok,
php produces HTML and apache sends it back to the browser (or client)
but now I've got a similar question (not strictly php-related I admit) that
starts from the fsockopen() example on php-manual:
____________________________________________________________
$fp = fsockopen ("www.php.net", 80, &$errno, &$errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET / HTTP/1.0\n\n");
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
____________________________________________________________
this gets the entire page (plus http headers) but /doesn't/ get the images
(or any other linked object)..
anybody knows why this happens ?
how does it work between server and browser?
how can I get the page /together/ with the images? (I know how to get
separately the images..)
anybody has a script to do this work?
TIA
Giuse
>Jaco:
>
>In the old days of DOS (before Windows) there was a concept widely
>known: Standard Input and Output. That is, a console application
>would take its input from the STD_IN device and would send its output
>to the STD_OUT device. I bet that this is exactly what PHP does, it
>sends its output to the STD_OUT device. If it runs from the command
>line, standard output is the screen, but if Apache (or any other web
>server) runs it, that application will capture (or redirect) the
>STD_OUT device, so that output from PHP is sent to the requesting
>browser.
>
>In this same manner, you can run PHP like this:
>
> php some_script.php >output.html
>
>you won't see anything on the screen, but a file named 'output.html'
>will be created. It will contain all the output generated by the
>script.
>
>Saludos,
>Pablo Vera
>_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
>Monday, September 04, 2000, 1:31:41 AM, Jaco wrote:
>
>JvdM> Hello,
>
>JvdM> The relevant setup is: Win98/php3/apache web server (or any other
web server...)
>
>JvdM> I have a good idea of how web servers work. It takes requests from
browsers and returns the relevant output to the browser. I know how this
works for a normal html page, but how does it work
>JvdM> when you request a php page?
>JvdM> I know it has to execute php somewhere in the middle. I played around
with php, running it from the command line, and then getting the result as
output to the screen. What I want to know
>JvdM> is...How does apache tell php where to send the output? If apache had
to just execute php, it would still send the output to the screen, right?,
and it has to go to the browser. Can someone
>JvdM> explain this concept to me? Some may say: "Just except the fact that
the thing works, and leave it at that!", but I would like to know how this
is done, 'cause I find it interesting.
>
>JvdM> If someone could just explain this to me, I would be grateful...
>
>JvdM> Thanx.
>
>JvdM> Jaco van der Merwe
>JvdM> Email: jaco@webapps.co.za
>JvdM> Phone: +27 83-725-0281
>JvdM> ICQ: 73549286
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
>For additional commands, e-mail: php-windows-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>