FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Apache and php to show http request headers.
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Apache and php to show http request headers. [message #178492] Mon, 25 June 2012 10:15 Go to next message
brumik is currently offline  brumik
Messages: 1
Registered: June 2012
Karma: 0
Junior Member
I need to test various http requests from an application and am using
Apache/PHP on ubuntu to display the http request headers. The
application proxy forwards http requests to the apache server's IP
address like as follows:

192.168.40.1/test/test.html

where 192.168.40.1 is the apache server.

I have a php script to dump the headers as follows:

<?php
foreach($_SERVER as $h=>$v)
#if(ereg('HTTP_(.+)',$h,$hp))
echo "<li>$h = $v</li>\n";
header('Content-type: text/html');
?>

The problem is that to show the headers, I redirect 192.168.40.1/* to
the above index.php page using the following redirect:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/index.php$

RewriteRule $ /index.php [R=302,L]

However the php request headers page always shows the URI as /
index.php as opposed to the 'original' URI requested (/test/
test.html).

How can I get it to show the 'original' URI requested? is this
something that can be done in PHP or is it apache specific?

thanks
Re: Apache and php to show http request headers. [message #178493 is a reply to message #178492] Mon, 25 June 2012 10:55 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 25-06-2012 12:15, brumik wrote:
>
> I need to test various http requests from an application and am using
> Apache/PHP on ubuntu to display the http request headers. The
> application proxy forwards http requests to the apache server's IP
> address like as follows:
>
> 192.168.40.1/test/test.html
>
> where 192.168.40.1 is the apache server.
>
> I have a php script to dump the headers as follows:
>
> <?php
> foreach($_SERVER as $h=>$v)
> #if(ereg('HTTP_(.+)',$h,$hp))
> echo "<li>$h = $v</li>\n";
> header('Content-type: text/html');
> ?>
>
> The problem is that to show the headers, I redirect 192.168.40.1/* to
> the above index.php page using the following redirect:
>
> Options +FollowSymlinks
> RewriteEngine on
> RewriteCond %{REQUEST_URI} !/index.php$
>
> RewriteRule $ /index.php [R=302,L]
>
> However the php request headers page always shows the URI as /
> index.php as opposed to the 'original' URI requested (/test/
> test.html).
>
> How can I get it to show the 'original' URI requested? is this
> something that can be done in PHP or is it apache specific?
>

Its apache, because it is redirecting, so PHP does only know about the
redirected request, and does have no knowledge of how this request
reached PHP.
Re: Apache and php to show http request headers. [message #178494 is a reply to message #178493] Mon, 25 June 2012 13:36 Go to previous messageGo to next message
tony is currently offline  tony
Messages: 19
Registered: December 2010
Karma: 0
Junior Member
In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
> On 25-06-2012 12:15, brumik wrote:
>>
>> I need to test various http requests from an application and am using
>> Apache/PHP on ubuntu to display the http request headers. The
>> application proxy forwards http requests to the apache server's IP
>> address like as follows:
>>
>> 192.168.40.1/test/test.html
>>
>> where 192.168.40.1 is the apache server.
>>
>> I have a php script to dump the headers as follows:
>>
>> <?php
>> foreach($_SERVER as $h=>$v)
>> #if(ereg('HTTP_(.+)',$h,$hp))
>> echo "<li>$h = $v</li>\n";
>> header('Content-type: text/html');
>> ?>
>>
>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>> the above index.php page using the following redirect:
>>
>> Options +FollowSymlinks
>> RewriteEngine on
>> RewriteCond %{REQUEST_URI} !/index.php$
>>
>> RewriteRule $ /index.php [R=302,L]
>>
>> However the php request headers page always shows the URI as /
>> index.php as opposed to the 'original' URI requested (/test/
>> test.html).
>>
>> How can I get it to show the 'original' URI requested? is this
>> something that can be done in PHP or is it apache specific?
>>
>
> Its apache, because it is redirecting, so PHP does only know about the
> redirected request, and does have no knowledge of how this request
> reached PHP.

You could try the Proxy flag in the RewriteRule:

RewriteRule $ http://localhost/index.php [P,L]

Cheers
Tony
--
Tony Mountifield
Work: tony(at)softins(dot)co(dot)uk - http://www.softins.co.uk
Play: tony(at)mountifield(dot)org - http://tony.mountifield.org
Re: Apache and php to show http request headers. [message #178495 is a reply to message #178494] Mon, 25 June 2012 13:41 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 9:36 AM, Tony Mountifield wrote:
> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>> On 25-06-2012 12:15, brumik wrote:
>>>
>>> I need to test various http requests from an application and am using
>>> Apache/PHP on ubuntu to display the http request headers. The
>>> application proxy forwards http requests to the apache server's IP
>>> address like as follows:
>>>
>>> 192.168.40.1/test/test.html
>>>
>>> where 192.168.40.1 is the apache server.
>>>
>>> I have a php script to dump the headers as follows:
>>>
>>> <?php
>>> foreach($_SERVER as $h=>$v)
>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>> echo "<li>$h = $v</li>\n";
>>> header('Content-type: text/html');
>>> ?>
>>>
>>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>> the above index.php page using the following redirect:
>>>
>>> Options +FollowSymlinks
>>> RewriteEngine on
>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>
>>> RewriteRule $ /index.php [R=302,L]
>>>
>>> However the php request headers page always shows the URI as /
>>> index.php as opposed to the 'original' URI requested (/test/
>>> test.html).
>>>
>>> How can I get it to show the 'original' URI requested? is this
>>> something that can be done in PHP or is it apache specific?
>>>
>>
>> Its apache, because it is redirecting, so PHP does only know about the
>> redirected request, and does have no knowledge of how this request
>> reached PHP.
>
> You could try the Proxy flag in the RewriteRule:
>
> RewriteRule $ http://localhost/index.php [P,L]
>
> Cheers
> Tony
>

He can try a lot of things which won't work.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Apache and php to show http request headers. [message #178496 is a reply to message #178495] Mon, 25 June 2012 14:42 Go to previous messageGo to next message
tony is currently offline  tony
Messages: 19
Registered: December 2010
Karma: 0
Junior Member
In article <js9pqt$1lm$1(at)dont-email(dot)me>,
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>> On 25-06-2012 12:15, brumik wrote:
>>>>
>>>> I need to test various http requests from an application and am using
>>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> application proxy forwards http requests to the apache server's IP
>>>> address like as follows:
>>>>
>>>> 192.168.40.1/test/test.html
>>>>
>>>> where 192.168.40.1 is the apache server.
>>>>
>>>> I have a php script to dump the headers as follows:
>>>>
>>>> <?php
>>>> foreach($_SERVER as $h=>$v)
>>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> echo "<li>$h = $v</li>\n";
>>>> header('Content-type: text/html');
>>>> ?>
>>>>
>>>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> the above index.php page using the following redirect:
>>>>
>>>> Options +FollowSymlinks
>>>> RewriteEngine on
>>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>>
>>>> RewriteRule $ /index.php [R=302,L]
>>>>
>>>> However the php request headers page always shows the URI as /
>>>> index.php as opposed to the 'original' URI requested (/test/
>>>> test.html).
>>>>
>>>> How can I get it to show the 'original' URI requested? is this
>>>> something that can be done in PHP or is it apache specific?
>>>>
>>>
>>> Its apache, because it is redirecting, so PHP does only know about the
>>> redirected request, and does have no knowledge of how this request
>>> reached PHP.
>>
>> You could try the Proxy flag in the RewriteRule:
>>
>> RewriteRule $ http://localhost/index.php [P,L]
>
> He can try a lot of things which won't work.

Well, yes, but I didn't think my suggestion was one of them. If you
think it is, I would like to know why, so that I would know for the
future, rather than just be the target of a bit of sarcasm. You could
try something like "That won't work because...." (if applicable).

The OP's original rule obviously wouldn't work, because it tells the
client browser to generate a completely fresh request with the new
location. In contrast, the Proxy flag in RewriteRule is supposed to
make Apache proxy the original request to the new location (even to
itself if necessary). So the request's original headers should still
be present, with perhaps one or more proxy headers.

Cheers
Tony
--
Tony Mountifield
Work: tony(at)softins(dot)co(dot)uk - http://www.softins.co.uk
Play: tony(at)mountifield(dot)org - http://tony.mountifield.org
Re: Apache and php to show http request headers. [message #178497 is a reply to message #178496] Mon, 25 June 2012 14:44 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 10:42 AM, Tony Mountifield wrote:
> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> On 25-06-2012 12:15, brumik wrote:
>>>> >
>>>> > I need to test various http requests from an application and am using
>>>> > Apache/PHP on ubuntu to display the http request headers. The
>>>> > application proxy forwards http requests to the apache server's IP
>>>> > address like as follows:
>>>> >
>>>> > 192.168.40.1/test/test.html
>>>> >
>>>> > where 192.168.40.1 is the apache server.
>>>> >
>>>> > I have a php script to dump the headers as follows:
>>>> >
>>>> > <?php
>>>> > foreach($_SERVER as $h=>$v)
>>>> > #if(ereg('HTTP_(.+)',$h,$hp))
>>>> > echo "<li>$h = $v</li>\n";
>>>> > header('Content-type: text/html');
>>>> > ?>
>>>> >
>>>> > The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> > the above index.php page using the following redirect:
>>>> >
>>>> > Options +FollowSymlinks
>>>> > RewriteEngine on
>>>> > RewriteCond %{REQUEST_URI} !/index.php$
>>>> >
>>>> > RewriteRule $ /index.php [R=302,L]
>>>> >
>>>> > However the php request headers page always shows the URI as /
>>>> > index.php as opposed to the 'original' URI requested (/test/
>>>> > test.html).
>>>> >
>>>> > How can I get it to show the 'original' URI requested? is this
>>>> > something that can be done in PHP or is it apache specific?
>>>> >
>>>>
>>>> Its apache, because it is redirecting, so PHP does only know about the
>>>> redirected request, and does have no knowledge of how this request
>>>> reached PHP.
>>>
>>> You could try the Proxy flag in the RewriteRule:
>>>
>>> RewriteRule $ http://localhost/index.php [P,L]
>>
>> He can try a lot of things which won't work.
>
> Well, yes, but I didn't think my suggestion was one of them. If you
> think it is, I would like to know why, so that I would know for the
> future, rather than just be the target of a bit of sarcasm. You could
> try something like "That won't work because...." (if applicable).
>
> The OP's original rule obviously wouldn't work, because it tells the
> client browser to generate a completely fresh request with the new
> location. In contrast, the Proxy flag in RewriteRule is supposed to
> make Apache proxy the original request to the new location (even to
> itself if necessary). So the request's original headers should still
> be present, with perhaps one or more proxy headers.
>
> Cheers
> Tony
>

It's off topic in this newsgroup. If you want to know why, try an
appropriate newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Apache and php to show http request headers. [message #178498 is a reply to message #178497] Mon, 25 June 2012 16:10 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 25.06.2012 16:44, schrieb Jerry Stuckle:
> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> > On 25-06-2012 12:15, brumik wrote:
>>>> >>
>>>> >> I need to test various http requests from an application and am using
>>>> >> Apache/PHP on ubuntu to display the http request headers. The
>>>> >> application proxy forwards http requests to the apache server's IP
>>>> >> address like as follows:
>>>> >>
>>>> >> 192.168.40.1/test/test.html
>>>> >>
>>>> >> where 192.168.40.1 is the apache server.
>>>> >>
>>>> >> I have a php script to dump the headers as follows:
>>>> >>
>>>> >> <?php
>>>> >> foreach($_SERVER as $h=>$v)
>>>> >> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >> echo "<li>$h = $v</li>\n";
>>>> >> header('Content-type: text/html');
>>>> >> ?>
>>>> >>
>>>> >> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >> the above index.php page using the following redirect:
>>>> >>
>>>> >> Options +FollowSymlinks
>>>> >> RewriteEngine on
>>>> >> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>
>>>> >> RewriteRule $ /index.php [R=302,L]
>>>> >>
>>>> >> However the php request headers page always shows the URI as /
>>>> >> index.php as opposed to the 'original' URI requested (/test/
>>>> >> test.html).
>>>> >>
>>>> >> How can I get it to show the 'original' URI requested? is this
>>>> >> something that can be done in PHP or is it apache specific?
>>>> >>
>>>> >
>>>> > Its apache, because it is redirecting, so PHP does only know about the
>>>> > redirected request, and does have no knowledge of how this request
>>>> > reached PHP.
>>>>
>>>> You could try the Proxy flag in the RewriteRule:
>>>>
>>>> RewriteRule $ http://localhost/index.php [P,L]
>>>
>>> He can try a lot of things which won't work.
>>
>> Well, yes, but I didn't think my suggestion was one of them. If you
>> think it is, I would like to know why, so that I would know for the
>> future, rather than just be the target of a bit of sarcasm. You could
>> try something like "That won't work because...." (if applicable).
>>
>> The OP's original rule obviously wouldn't work, because it tells the
>> client browser to generate a completely fresh request with the new
>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>> make Apache proxy the original request to the new location (even to
>> itself if necessary). So the request's original headers should still
>> be present, with perhaps one or more proxy headers.
>>
>> Cheers
>> Tony
>>
>
> It's off topic in this newsgroup. If you want to know why, try an appropriate
> newsgroup.
>

Truth is never off topic.

/Str.
Re: Apache and php to show http request headers. [message #178499 is a reply to message #178498] Mon, 25 June 2012 16:48 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 12:10 PM, M. Strobel wrote:
> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> > In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >> On 25-06-2012 12:15, brumik wrote:
>>>> >>>
>>>> >>> I need to test various http requests from an application and am using
>>>> >>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>> application proxy forwards http requests to the apache server's IP
>>>> >>> address like as follows:
>>>> >>>
>>>> >>> 192.168.40.1/test/test.html
>>>> >>>
>>>> >>> where 192.168.40.1 is the apache server.
>>>> >>>
>>>> >>> I have a php script to dump the headers as follows:
>>>> >>>
>>>> >>> <?php
>>>> >>> foreach($_SERVER as $h=>$v)
>>>> >>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>> echo "<li>$h = $v</li>\n";
>>>> >>> header('Content-type: text/html');
>>>> >>> ?>
>>>> >>>
>>>> >>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >>> the above index.php page using the following redirect:
>>>> >>>
>>>> >>> Options +FollowSymlinks
>>>> >>> RewriteEngine on
>>>> >>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>
>>>> >>> RewriteRule $ /index.php [R=302,L]
>>>> >>>
>>>> >>> However the php request headers page always shows the URI as /
>>>> >>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>> test.html).
>>>> >>>
>>>> >>> How can I get it to show the 'original' URI requested? is this
>>>> >>> something that can be done in PHP or is it apache specific?
>>>> >>>
>>>> >>
>>>> >> Its apache, because it is redirecting, so PHP does only know about the
>>>> >> redirected request, and does have no knowledge of how this request
>>>> >> reached PHP.
>>>> >
>>>> > You could try the Proxy flag in the RewriteRule:
>>>> >
>>>> > RewriteRule $ http://localhost/index.php [P,L]
>>>>
>>>> He can try a lot of things which won't work.
>>>
>>> Well, yes, but I didn't think my suggestion was one of them. If you
>>> think it is, I would like to know why, so that I would know for the
>>> future, rather than just be the target of a bit of sarcasm. You could
>>> try something like "That won't work because...." (if applicable).
>>>
>>> The OP's original rule obviously wouldn't work, because it tells the
>>> client browser to generate a completely fresh request with the new
>>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>> make Apache proxy the original request to the new location (even to
>>> itself if necessary). So the request's original headers should still
>>> be present, with perhaps one or more proxy headers.
>>>
>>> Cheers
>>> Tony
>>>
>>
>> It's off topic in this newsgroup. If you want to know why, try an appropriate
>> newsgroup.
>>
>
> Truth is never off topic.
>
> /Str.
>

Only in your small mind. This is a PHP group - hence the "PHP" in its
name. There are other groups where experts in that area hang out.

And your comment shows why there are so many crappy answers to off-topic
questions in this newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Apache and php to show http request headers. [message #178500 is a reply to message #178499] Mon, 25 June 2012 17:17 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 25.06.2012 18:48, schrieb Jerry Stuckle:
> On 6/25/2012 12:10 PM, M. Strobel wrote:
>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> > On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>>
>>>> >>>> I need to test various http requests from an application and am using
>>>> >>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>> application proxy forwards http requests to the apache server's IP
>>>> >>>> address like as follows:
>>>> >>>>
>>>> >>>> 192.168.40.1/test/test.html
>>>> >>>>
>>>> >>>> where 192.168.40.1 is the apache server.
>>>> >>>>
>>>> >>>> I have a php script to dump the headers as follows:
>>>> >>>>
>>>> >>>> <?php
>>>> >>>> foreach($_SERVER as $h=>$v)
>>>> >>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>>> echo "<li>$h = $v</li>\n";
>>>> >>>> header('Content-type: text/html');
>>>> >>>> ?>
>>>> >>>>
>>>> >>>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >>>> the above index.php page using the following redirect:
>>>> >>>>
>>>> >>>> Options +FollowSymlinks
>>>> >>>> RewriteEngine on
>>>> >>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>>
>>>> >>>> RewriteRule $ /index.php [R=302,L]
>>>> >>>>
>>>> >>>> However the php request headers page always shows the URI as /
>>>> >>>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>>> test.html).
>>>> >>>>
>>>> >>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>> something that can be done in PHP or is it apache specific?
>>>> >>>>
>>>> >>>
>>>> >>> Its apache, because it is redirecting, so PHP does only know about the
>>>> >>> redirected request, and does have no knowledge of how this request
>>>> >>> reached PHP.
>>>> >>
>>>> >> You could try the Proxy flag in the RewriteRule:
>>>> >>
>>>> >> RewriteRule $ http://localhost/index.php [P,L]
>>>> >
>>>> > He can try a lot of things which won't work.
>>>>
>>>> Well, yes, but I didn't think my suggestion was one of them. If you
>>>> think it is, I would like to know why, so that I would know for the
>>>> future, rather than just be the target of a bit of sarcasm. You could
>>>> try something like "That won't work because...." (if applicable).
>>>>
>>>> The OP's original rule obviously wouldn't work, because it tells the
>>>> client browser to generate a completely fresh request with the new
>>>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> make Apache proxy the original request to the new location (even to
>>>> itself if necessary). So the request's original headers should still
>>>> be present, with perhaps one or more proxy headers.
>>>>
>>>> Cheers
>>>> Tony
>>>>
>>>
>>> It's off topic in this newsgroup. If you want to know why, try an appropriate
>>> newsgroup.
>>>
>>
>> Truth is never off topic.
>>
>> /Str.
>>
>
> Only in your small mind. This is a PHP group - hence the "PHP" in its name. There
> are other groups where experts in that area hang out.
>
> And your comment shows why there are so many crappy answers to off-topic questions in
> this newsgroup.
>
Ah, small mind. What could PHP do without Apache servers?

/Str.
Re: Apache and php to show http request headers. [message #178501 is a reply to message #178498] Mon, 25 June 2012 17:09 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 25-06-2012 18:10, M. Strobel wrote:
> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> > In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >> On 25-06-2012 12:15, brumik wrote:
>>>> >>>
>>>> >>> I need to test various http requests from an application and am using
>>>> >>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>> application proxy forwards http requests to the apache server's IP
>>>> >>> address like as follows:
>>>> >>>
>>>> >>> 192.168.40.1/test/test.html
>>>> >>>
>>>> >>> where 192.168.40.1 is the apache server.
>>>> >>>
>>>> >>> I have a php script to dump the headers as follows:
>>>> >>>
>>>> >>> <?php
>>>> >>> foreach($_SERVER as $h=>$v)
>>>> >>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>> echo "<li>$h = $v</li>\n";
>>>> >>> header('Content-type: text/html');
>>>> >>> ?>
>>>> >>>
>>>> >>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >>> the above index.php page using the following redirect:
>>>> >>>
>>>> >>> Options +FollowSymlinks
>>>> >>> RewriteEngine on
>>>> >>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>
>>>> >>> RewriteRule $ /index.php [R=302,L]
>>>> >>>
>>>> >>> However the php request headers page always shows the URI as /
>>>> >>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>> test.html).
>>>> >>>
>>>> >>> How can I get it to show the 'original' URI requested? is this
>>>> >>> something that can be done in PHP or is it apache specific?
>>>> >>>
>>>> >>
>>>> >> Its apache, because it is redirecting, so PHP does only know about the
>>>> >> redirected request, and does have no knowledge of how this request
>>>> >> reached PHP.
>>>> >
>>>> > You could try the Proxy flag in the RewriteRule:
>>>> >
>>>> > RewriteRule $ http://localhost/index.php [P,L]
>>>>
>>>> He can try a lot of things which won't work.
>>>
>>> Well, yes, but I didn't think my suggestion was one of them. If you
>>> think it is, I would like to know why, so that I would know for the
>>> future, rather than just be the target of a bit of sarcasm. You could
>>> try something like "That won't work because...." (if applicable).
>>>
>>> The OP's original rule obviously wouldn't work, because it tells the
>>> client browser to generate a completely fresh request with the new
>>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>> make Apache proxy the original request to the new location (even to
>>> itself if necessary). So the request's original headers should still
>>> be present, with perhaps one or more proxy headers.
>>>
>>> Cheers
>>> Tony
>>>
>>
>> It's off topic in this newsgroup. If you want to know why, try an appropriate
>> newsgroup.
>>
>
> Truth is never off topic.
>
> /Str.
>

Ok,

Its about apache, the webserver that most of the time sits in front of PHP,

In their docs (http://httpd.apache.org/docs/2.2/mod/mod_proxy.html):
An ordinary forward proxy is an intermediate server that sits between
the client and the origin server. In order to get content from the
origin server, the client sends a request to the proxy naming the origin
server as the target and the proxy then requests the content from the
origin server and returns it to the client. The client must be specially
configured to use the forward proxy to access other sites.

The important part here is:
"the proxy then requests the content from the origin server"

Therefore PHP does know nothing about a proxyserver......
Re: Apache and php to show http request headers. [message #178502 is a reply to message #178500] Mon, 25 June 2012 17:46 Go to previous messageGo to next message
Daniel Pitts is currently offline  Daniel Pitts
Messages: 68
Registered: May 2012
Karma: 0
Member
On 6/25/12 10:17 AM, M. Strobel wrote:
> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>> On 6/25/2012 12:10 PM, M. Strobel wrote:
>>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> > In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> > Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> >> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >>>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>>>
>>>> >>>>> I need to test various http requests from an application and am using
>>>> >>>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>>> application proxy forwards http requests to the apache server's IP
>>>> >>>>> address like as follows:
>>>> >>>>>
>>>> >>>>> 192.168.40.1/test/test.html
>>>> >>>>>
>>>> >>>>> where 192.168.40.1 is the apache server.
>>>> >>>>>
>>>> >>>>> I have a php script to dump the headers as follows:
>>>> >>>>>
>>>> >>>>> <?php
>>>> >>>>> foreach($_SERVER as $h=>$v)
>>>> >>>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>>>> echo "<li>$h = $v</li>\n";
>>>> >>>>> header('Content-type: text/html');
>>>> >>>>> ?>
>>>> >>>>>
>>>> >>>>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >>>>> the above index.php page using the following redirect:
>>>> >>>>>
>>>> >>>>> Options +FollowSymlinks
>>>> >>>>> RewriteEngine on
>>>> >>>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>>>
>>>> >>>>> RewriteRule $ /index.php [R=302,L]
>>>> >>>>>
>>>> >>>>> However the php request headers page always shows the URI as /
>>>> >>>>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>>>> test.html).
>>>> >>>>>
>>>> >>>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>>> something that can be done in PHP or is it apache specific?
>>>> >>>>>
>>>> >>>>
>>>> >>>> Its apache, because it is redirecting, so PHP does only know about the
>>>> >>>> redirected request, and does have no knowledge of how this request
>>>> >>>> reached PHP.
>>>> >>>
>>>> >>> You could try the Proxy flag in the RewriteRule:
>>>> >>>
>>>> >>> RewriteRule $ http://localhost/index.php [P,L]
>>>> >>
>>>> >> He can try a lot of things which won't work.
>>>> >
>>>> > Well, yes, but I didn't think my suggestion was one of them. If you
>>>> > think it is, I would like to know why, so that I would know for the
>>>> > future, rather than just be the target of a bit of sarcasm. You could
>>>> > try something like "That won't work because...." (if applicable).
>>>> >
>>>> > The OP's original rule obviously wouldn't work, because it tells the
>>>> > client browser to generate a completely fresh request with the new
>>>> > location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> > make Apache proxy the original request to the new location (even to
>>>> > itself if necessary). So the request's original headers should still
>>>> > be present, with perhaps one or more proxy headers.
>>>> >
>>>> > Cheers
>>>> > Tony
>>>> >
>>>>
>>>> It's off topic in this newsgroup. If you want to know why, try an appropriate
>>>> newsgroup.
>>>>
>>>
>>> Truth is never off topic.
>>>
>>> /Str.
>>>
>>
>> Only in your small mind. This is a PHP group - hence the "PHP" in its name. There
>> are other groups where experts in that area hang out.
>>
>> And your comment shows why there are so many crappy answers to off-topic questions in
>> this newsgroup.
>>
> Ah, small mind. What could PHP do without Apache servers?
Quite a bit. Apache isn't a requirement for PHP by any means.
What can you do with PHP without a web server (Was: Apache and php to show http request headers.) [message #178503 is a reply to message #178500] Mon, 25 June 2012 17:48 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 25/06/12 19:17, M. Strobel wrote:
> Am 25.06.2012 18:48, schrieb Jerry Stuckle:

>> Only in your small mind. This is a PHP group - hence the "PHP" in its name. There
>> are other groups where experts in that area hang out.
>>
>> And your comment shows why there are so many crappy answers to off-topic questions in
>> this newsgroup.
>>
> Ah, small mind. What could PHP do without Apache servers?

Hmmm... you could make a GUI application as you could do with say C#.

--

//Aho
Re: Apache and php to show http request headers. [message #178504 is a reply to message #178498] Mon, 25 June 2012 17:55 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
M. Strobel wrote:
> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> > In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >> On 25-06-2012 12:15, brumik wrote:
>>>> >>> I need to test various http requests from an application and am using
>>>> >>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>> application proxy forwards http requests to the apache server's IP
>>>> >>> address like as follows:
>>>> >>>
>>>> >>> 192.168.40.1/test/test.html
>>>> >>>
>>>> >>> where 192.168.40.1 is the apache server.
>>>> >>>
>>>> >>> I have a php script to dump the headers as follows:
>>>> >>>
>>>> >>> <?php
>>>> >>> foreach($_SERVER as $h=>$v)
>>>> >>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>> echo "<li>$h = $v</li>\n";
>>>> >>> header('Content-type: text/html');
>>>> >>> ?>
>>>> >>>
>>>> >>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >>> the above index.php page using the following redirect:
>>>> >>>
>>>> >>> Options +FollowSymlinks
>>>> >>> RewriteEngine on
>>>> >>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>
>>>> >>> RewriteRule $ /index.php [R=302,L]
>>>> >>>
>>>> >>> However the php request headers page always shows the URI as /
>>>> >>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>> test.html).
>>>> >>>
>>>> >>> How can I get it to show the 'original' URI requested? is this
>>>> >>> something that can be done in PHP or is it apache specific?
>>>> >>>
>>>> >> Its apache, because it is redirecting, so PHP does only know about the
>>>> >> redirected request, and does have no knowledge of how this request
>>>> >> reached PHP.
>>>> > You could try the Proxy flag in the RewriteRule:
>>>> >
>>>> > RewriteRule $ http://localhost/index.php [P,L]
>>>> He can try a lot of things which won't work.
>>> Well, yes, but I didn't think my suggestion was one of them. If you
>>> think it is, I would like to know why, so that I would know for the
>>> future, rather than just be the target of a bit of sarcasm. You could
>>> try something like "That won't work because...." (if applicable).
>>>
>>> The OP's original rule obviously wouldn't work, because it tells the
>>> client browser to generate a completely fresh request with the new
>>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>> make Apache proxy the original request to the new location (even to
>>> itself if necessary). So the request's original headers should still
>>> be present, with perhaps one or more proxy headers.
>>>
>>> Cheers
>>> Tony
>>>
>> It's off topic in this newsgroup. If you want to know why, try an appropriate
>> newsgroup.
>>
>
> Truth is never off topic.
>
Jerry is always off topic then..
> /Str.
>


--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
Re: What can you do with PHP without a web server (Was: Apache and php to show http request headers.) [message #178505 is a reply to message #178503] Mon, 25 June 2012 17:59 Go to previous messageGo to next message
Daniel Pitts is currently offline  Daniel Pitts
Messages: 68
Registered: May 2012
Karma: 0
Member
On 6/25/12 10:48 AM, J.O. Aho wrote:
> On 25/06/12 19:17, M. Strobel wrote:
>> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>
>>> Only in your small mind. This is a PHP group - hence the "PHP" in
>>> its name. There
>>> are other groups where experts in that area hang out.
>>>
>>> And your comment shows why there are so many crappy answers to
>>> off-topic questions in
>>> this newsgroup.
>>>
>> Ah, small mind. What could PHP do without Apache servers?
>
> Hmmm... you could make a GUI application as you could do with say C#.
>
You could do anything with PHP without Apache that you could with
Apache. Apache isn't the only web server out there.
Re: Apache and php to show http request headers. [message #178506 is a reply to message #178502] Mon, 25 June 2012 18:00 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Daniel Pitts wrote:
> On 6/25/12 10:17 AM, M. Strobel wrote:
>> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>>> On 6/25/2012 12:10 PM, M. Strobel wrote:
>>>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> > On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> >> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> >> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> >>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >>>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk
>>>> >>>> <luuk(at)invalid(dot)lan> wrote:
>>>> >>>>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>>>>
>>>> >>>>>> I need to test various http requests from an application and
>>>> >>>>>> am using
>>>> >>>>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>>>> application proxy forwards http requests to the apache
>>>> >>>>>> server's IP
>>>> >>>>>> address like as follows:
>>>> >>>>>>
>>>> >>>>>> 192.168.40.1/test/test.html
>>>> >>>>>>
>>>> >>>>>> where 192.168.40.1 is the apache server.
>>>> >>>>>>
>>>> >>>>>> I have a php script to dump the headers as follows:
>>>> >>>>>>
>>>> >>>>>> <?php
>>>> >>>>>> foreach($_SERVER as $h=>$v)
>>>> >>>>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>>>>> echo "<li>$h = $v</li>\n";
>>>> >>>>>> header('Content-type: text/html');
>>>> >>>>>> ?>
>>>> >>>>>>
>>>> >>>>>> The problem is that to show the headers, I redirect
>>>> >>>>>> 192.168.40.1/* to
>>>> >>>>>> the above index.php page using the following redirect:
>>>> >>>>>>
>>>> >>>>>> Options +FollowSymlinks
>>>> >>>>>> RewriteEngine on
>>>> >>>>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>>>>
>>>> >>>>>> RewriteRule $ /index.php [R=302,L]
>>>> >>>>>>
>>>> >>>>>> However the php request headers page always shows the URI as /
>>>> >>>>>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>>>>> test.html).
>>>> >>>>>>
>>>> >>>>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>>>> something that can be done in PHP or is it apache specific?
>>>> >>>>>>
>>>> >>>>>
>>>> >>>>> Its apache, because it is redirecting, so PHP does only know
>>>> >>>>> about the
>>>> >>>>> redirected request, and does have no knowledge of how this request
>>>> >>>>> reached PHP.
>>>> >>>>
>>>> >>>> You could try the Proxy flag in the RewriteRule:
>>>> >>>>
>>>> >>>> RewriteRule $ http://localhost/index.php [P,L]
>>>> >>>
>>>> >>> He can try a lot of things which won't work.
>>>> >>
>>>> >> Well, yes, but I didn't think my suggestion was one of them. If you
>>>> >> think it is, I would like to know why, so that I would know for the
>>>> >> future, rather than just be the target of a bit of sarcasm. You could
>>>> >> try something like "That won't work because...." (if applicable).
>>>> >>
>>>> >> The OP's original rule obviously wouldn't work, because it tells the
>>>> >> client browser to generate a completely fresh request with the new
>>>> >> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> >> make Apache proxy the original request to the new location (even to
>>>> >> itself if necessary). So the request's original headers should still
>>>> >> be present, with perhaps one or more proxy headers.
>>>> >>
>>>> >> Cheers
>>>> >> Tony
>>>> >>
>>>> >
>>>> > It's off topic in this newsgroup. If you want to know why, try an
>>>> > appropriate
>>>> > newsgroup.
>>>> >
>>>>
>>>> Truth is never off topic.
>>>>
>>>> /Str.
>>>>
>>>
>>> Only in your small mind. This is a PHP group - hence the "PHP" in
>>> its name. There
>>> are other groups where experts in that area hang out.
>>>
>>> And your comment shows why there are so many crappy answers to
>>> off-topic questions in
>>> this newsgroup.
>>>
>> Ah, small mind. What could PHP do without Apache servers?
> Quite a bit. Apache isn't a requirement for PHP by any means.
>
>
No but then neither is a road for a car, nevertheless I wouldn't
normally consider using a car off road ...

The clue of course is in the name

"While PHP originally stood for "Personal Home Page", it is now said to
stand for "PHP: Hypertext Preprocessor"." (wiki)

Frankly I have always felt Produces HHML Pages was nearer the mark.

--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
Re: Apache and php to show http request headers. [message #178507 is a reply to message #178506] Mon, 25 June 2012 18:22 Go to previous messageGo to next message
Daniel Pitts is currently offline  Daniel Pitts
Messages: 68
Registered: May 2012
Karma: 0
Member
On 6/25/12 11:00 AM, The Natural Philosopher wrote:
> Daniel Pitts wrote:
>> On 6/25/12 10:17 AM, M. Strobel wrote:
>>> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>>>> On 6/25/2012 12:10 PM, M. Strobel wrote:
>>>> > Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> >> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> >>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> >>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> >>>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >>>>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk
>>>> >>>>> <luuk(at)invalid(dot)lan> wrote:
>>>> >>>>>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>>>>>
>>>> >>>>>>> I need to test various http requests from an application and
>>>> >>>>>>> am using
>>>> >>>>>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>>>>> application proxy forwards http requests to the apache
>>>> >>>>>>> server's IP
>>>> >>>>>>> address like as follows:
>>>> >>>>>>>
>>>> >>>>>>> 192.168.40.1/test/test.html
>>>> >>>>>>>
>>>> >>>>>>> where 192.168.40.1 is the apache server.
>>>> >>>>>>>
>>>> >>>>>>> I have a php script to dump the headers as follows:
>>>> >>>>>>>
>>>> >>>>>>> <?php
>>>> >>>>>>> foreach($_SERVER as $h=>$v)
>>>> >>>>>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>>>>>> echo "<li>$h = $v</li>\n";
>>>> >>>>>>> header('Content-type: text/html');
>>>> >>>>>>> ?>
>>>> >>>>>>>
>>>> >>>>>>> The problem is that to show the headers, I redirect
>>>> >>>>>>> 192.168.40.1/* to
>>>> >>>>>>> the above index.php page using the following redirect:
>>>> >>>>>>>
>>>> >>>>>>> Options +FollowSymlinks
>>>> >>>>>>> RewriteEngine on
>>>> >>>>>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>>>>>
>>>> >>>>>>> RewriteRule $ /index.php [R=302,L]
>>>> >>>>>>>
>>>> >>>>>>> However the php request headers page always shows the URI as /
>>>> >>>>>>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>>>>>> test.html).
>>>> >>>>>>>
>>>> >>>>>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>>>>> something that can be done in PHP or is it apache specific?
>>>> >>>>>>>
>>>> >>>>>>
>>>> >>>>>> Its apache, because it is redirecting, so PHP does only know
>>>> >>>>>> about the
>>>> >>>>>> redirected request, and does have no knowledge of how this
>>>> >>>>>> request
>>>> >>>>>> reached PHP.
>>>> >>>>>
>>>> >>>>> You could try the Proxy flag in the RewriteRule:
>>>> >>>>>
>>>> >>>>> RewriteRule $ http://localhost/index.php [P,L]
>>>> >>>>
>>>> >>>> He can try a lot of things which won't work.
>>>> >>>
>>>> >>> Well, yes, but I didn't think my suggestion was one of them. If you
>>>> >>> think it is, I would like to know why, so that I would know for the
>>>> >>> future, rather than just be the target of a bit of sarcasm. You
>>>> >>> could
>>>> >>> try something like "That won't work because...." (if applicable).
>>>> >>>
>>>> >>> The OP's original rule obviously wouldn't work, because it tells the
>>>> >>> client browser to generate a completely fresh request with the new
>>>> >>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> >>> make Apache proxy the original request to the new location (even to
>>>> >>> itself if necessary). So the request's original headers should still
>>>> >>> be present, with perhaps one or more proxy headers.
>>>> >>>
>>>> >>> Cheers
>>>> >>> Tony
>>>> >>>
>>>> >>
>>>> >> It's off topic in this newsgroup. If you want to know why, try an
>>>> >> appropriate
>>>> >> newsgroup.
>>>> >>
>>>> >
>>>> > Truth is never off topic.
>>>> >
>>>> > /Str.
>>>> >
>>>>
>>>> Only in your small mind. This is a PHP group - hence the "PHP" in
>>>> its name. There
>>>> are other groups where experts in that area hang out.
>>>>
>>>> And your comment shows why there are so many crappy answers to
>>>> off-topic questions in
>>>> this newsgroup.
>>>>
>>> Ah, small mind. What could PHP do without Apache servers?
>> Quite a bit. Apache isn't a requirement for PHP by any means.
>>
>>
> No but then neither is a road for a car, nevertheless I wouldn't
> normally consider using a car off road ...
Straw man; the car/road analogy is lacking. There are *other* web
servers than Apache, such as nginx for example.

Asking an Apache specific question here is like asking a Windows
question on c.l.javascript.
Re: Apache and php to show http request headers. [message #178508 is a reply to message #178500] Mon, 25 June 2012 19:06 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 1:17 PM, M. Strobel wrote:
> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>> On 6/25/2012 12:10 PM, M. Strobel wrote:
>>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> > In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> > Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> >> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >>>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>>>
>>>> >>>>> I need to test various http requests from an application and am using
>>>> >>>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>>> application proxy forwards http requests to the apache server's IP
>>>> >>>>> address like as follows:
>>>> >>>>>
>>>> >>>>> 192.168.40.1/test/test.html
>>>> >>>>>
>>>> >>>>> where 192.168.40.1 is the apache server.
>>>> >>>>>
>>>> >>>>> I have a php script to dump the headers as follows:
>>>> >>>>>
>>>> >>>>> <?php
>>>> >>>>> foreach($_SERVER as $h=>$v)
>>>> >>>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>>>> echo "<li>$h = $v</li>\n";
>>>> >>>>> header('Content-type: text/html');
>>>> >>>>> ?>
>>>> >>>>>
>>>> >>>>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >>>>> the above index.php page using the following redirect:
>>>> >>>>>
>>>> >>>>> Options +FollowSymlinks
>>>> >>>>> RewriteEngine on
>>>> >>>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>>>
>>>> >>>>> RewriteRule $ /index.php [R=302,L]
>>>> >>>>>
>>>> >>>>> However the php request headers page always shows the URI as /
>>>> >>>>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>>>> test.html).
>>>> >>>>>
>>>> >>>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>>> something that can be done in PHP or is it apache specific?
>>>> >>>>>
>>>> >>>>
>>>> >>>> Its apache, because it is redirecting, so PHP does only know about the
>>>> >>>> redirected request, and does have no knowledge of how this request
>>>> >>>> reached PHP.
>>>> >>>
>>>> >>> You could try the Proxy flag in the RewriteRule:
>>>> >>>
>>>> >>> RewriteRule $ http://localhost/index.php [P,L]
>>>> >>
>>>> >> He can try a lot of things which won't work.
>>>> >
>>>> > Well, yes, but I didn't think my suggestion was one of them. If you
>>>> > think it is, I would like to know why, so that I would know for the
>>>> > future, rather than just be the target of a bit of sarcasm. You could
>>>> > try something like "That won't work because...." (if applicable).
>>>> >
>>>> > The OP's original rule obviously wouldn't work, because it tells the
>>>> > client browser to generate a completely fresh request with the new
>>>> > location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> > make Apache proxy the original request to the new location (even to
>>>> > itself if necessary). So the request's original headers should still
>>>> > be present, with perhaps one or more proxy headers.
>>>> >
>>>> > Cheers
>>>> > Tony
>>>> >
>>>>
>>>> It's off topic in this newsgroup. If you want to know why, try an appropriate
>>>> newsgroup.
>>>>
>>>
>>> Truth is never off topic.
>>>
>>> /Str.
>>>
>>
>> Only in your small mind. This is a PHP group - hence the "PHP" in its name. There
>> are other groups where experts in that area hang out.
>>
>> And your comment shows why there are so many crappy answers to off-topic questions in
>> this newsgroup.
>>
> Ah, small mind. What could PHP do without Apache servers?
>
> /Str.
>

A lot.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Apache and php to show http request headers. [message #178509 is a reply to message #178507] Mon, 25 June 2012 19:09 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 25-06-2012 20:22, Daniel Pitts wrote:
>
> Asking an Apache specific question here is like asking a Windows
> question on c.l.javascript.

But someone who is working with PHP (or doing thing with it), should
have basic knowledge about the environment where PHP is running...
Re: Apache and php to show http request headers. [message #178510 is a reply to message #178504] Mon, 25 June 2012 19:25 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 25.06.2012 19:55, schrieb The Natural Philosopher:
> M. Strobel wrote:
>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> > On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>> I need to test various http requests from an application and am using
>>>> >>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>> application proxy forwards http requests to the apache server's IP
>>>> >>>> address like as follows:
>>>> >>>>
---cut---

>>>> >>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>> something that can be done in PHP or is it apache specific?
>>>> >>>>
>>>> >>> Its apache, because it is redirecting, so PHP does only know about the
>>>> >>> redirected request, and does have no knowledge of how this request
>>>> >>> reached PHP.
>>>> >> You could try the Proxy flag in the RewriteRule:
>>>> >>
>>>> >> RewriteRule $ http://localhost/index.php [P,L]
>>>> > He can try a lot of things which won't work.
>>>> Well, yes, but I didn't think my suggestion was one of them. If you
>>>> think it is, I would like to know why, so that I would know for the
>>>> future, rather than just be the target of a bit of sarcasm. You could
>>>> try something like "That won't work because...." (if applicable).
>>>>
>>>> The OP's original rule obviously wouldn't work, because it tells the
>>>> client browser to generate a completely fresh request with the new
>>>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> make Apache proxy the original request to the new location (even to
>>>> itself if necessary). So the request's original headers should still
>>>> be present, with perhaps one or more proxy headers.
>>>>
>>>> Cheers
>>>> Tony
>>>>
>>> It's off topic in this newsgroup. If you want to know why, try an appropriate
>>> newsgroup.
>>>
>>
>> Truth is never off topic.
>>
> Jerry is always off topic then..

Dead on target.

And he is putting more effort into telling everyone what is off topic than would be
required to answer the question.

/Str.
Re: Apache and php to show http request headers. [message #178511 is a reply to message #178502] Mon, 25 June 2012 19:32 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 25.06.2012 19:46, schrieb Daniel Pitts:
> On 6/25/12 10:17 AM, M. Strobel wrote:
>> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>>> On 6/25/2012 12:10 PM, M. Strobel wrote:
>>>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> > On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> >> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> >> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> >>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >>>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >>>>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>>>>
>>>> >>>>>> I need to test various http requests from an application and am using
>>>> >>>>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>>>> application proxy forwards http requests to the apache server's IP
>>>> >>>>>> address like as follows:
>>>> >>>>>>
>>>> >>>>>> 192.168.40.1/test/test.html
>>>> >>>>>>
>>>> >>>>>> where 192.168.40.1 is the apache server.
>>>> >>>>>>
>>>> >>>>>> I have a php script to dump the headers as follows:
>>>> >>>>>>
>>>> >>>>>> <?php
>>>> >>>>>> foreach($_SERVER as $h=>$v)
>>>> >>>>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>>>>> echo "<li>$h = $v</li>\n";
>>>> >>>>>> header('Content-type: text/html');
>>>> >>>>>> ?>
>>>> >>>>>>
>>>> >>>>>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >>>>>> the above index.php page using the following redirect:
>>>> >>>>>>
>>>> >>>>>> Options +FollowSymlinks
>>>> >>>>>> RewriteEngine on
>>>> >>>>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>>>>
>>>> >>>>>> RewriteRule $ /index.php [R=302,L]
>>>> >>>>>>
>>>> >>>>>> However the php request headers page always shows the URI as /
>>>> >>>>>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>>>>> test.html).
>>>> >>>>>>
>>>> >>>>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>>>> something that can be done in PHP or is it apache specific?
>>>> >>>>>>
>>>> >>>>>
>>>> >>>>> Its apache, because it is redirecting, so PHP does only know about the
>>>> >>>>> redirected request, and does have no knowledge of how this request
>>>> >>>>> reached PHP.
>>>> >>>>
>>>> >>>> You could try the Proxy flag in the RewriteRule:
>>>> >>>>
>>>> >>>> RewriteRule $ http://localhost/index.php [P,L]
>>>> >>>
>>>> >>> He can try a lot of things which won't work.
>>>> >>
>>>> >> Well, yes, but I didn't think my suggestion was one of them. If you
>>>> >> think it is, I would like to know why, so that I would know for the
>>>> >> future, rather than just be the target of a bit of sarcasm. You could
>>>> >> try something like "That won't work because...." (if applicable).
>>>> >>
>>>> >> The OP's original rule obviously wouldn't work, because it tells the
>>>> >> client browser to generate a completely fresh request with the new
>>>> >> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> >> make Apache proxy the original request to the new location (even to
>>>> >> itself if necessary). So the request's original headers should still
>>>> >> be present, with perhaps one or more proxy headers.
>>>> >>
>>>> >> Cheers
>>>> >> Tony
>>>> >>
>>>> >
>>>> > It's off topic in this newsgroup. If you want to know why, try an appropriate
>>>> > newsgroup.
>>>> >
>>>>
>>>> Truth is never off topic.
>>>>
>>>> /Str.
>>>>
>>>
>>> Only in your small mind. This is a PHP group - hence the "PHP" in its name. There
>>> are other groups where experts in that area hang out.
>>>
>>> And your comment shows why there are so many crappy answers to off-topic questions in
>>> this newsgroup.
>>>
>> Ah, small mind. What could PHP do without Apache servers?
> Quite a bit. Apache isn't a requirement for PHP by any means.

Who is talking about requirement?

The point was JS saying Apache is off topic for PHP, and I tried to hint to the
importance of Apache for PHP web programming.

see http://phpadvent.org/2010/usage-statistics-by-ilia-alshanetsky

/Str.
Re: Apache and php to show http request headers. [message #178512 is a reply to message #178507] Mon, 25 June 2012 19:36 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 25.06.2012 20:22, schrieb Daniel Pitts:
> On 6/25/12 11:00 AM, The Natural Philosopher wrote:
>> Daniel Pitts wrote:
>>> On 6/25/12 10:17 AM, M. Strobel wrote:
>>>> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>>>> > On 6/25/2012 12:10 PM, M. Strobel wrote:
>>>> >> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> >>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> >>>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> >>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> >>>>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >>>>>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk
>>>> >>>>>> <luuk(at)invalid(dot)lan> wrote:
>>>> >>>>>>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>>>>>>
>>>> >>>>>>>> I need to test various http requests from an application and
>>>> >>>>>>>> am using
>>>> >>>>>>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>>>>>> application proxy forwards http requests to the apache
>>>> >>>>>>>> server's IP
>>>> >>>>>>>> address like as follows:
>>>> >>>>>>>>
>>>> >>>>>>>> 192.168.40.1/test/test.html
>>>> >>>>>>>>
>>>> >>>>>>>> where 192.168.40.1 is the apache server.
>>>> >>>>>>>>
>>>> >>>>>>>> I have a php script to dump the headers as follows:
>>>> >>>>>>>>
>>>> >>>>>>>> <?php
>>>> >>>>>>>> foreach($_SERVER as $h=>$v)
>>>> >>>>>>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>>>>>>> echo "<li>$h = $v</li>\n";
>>>> >>>>>>>> header('Content-type: text/html');
>>>> >>>>>>>> ?>
>>>> >>>>>>>>
>>>> >>>>>>>> The problem is that to show the headers, I redirect
>>>> >>>>>>>> 192.168.40.1/* to
>>>> >>>>>>>> the above index.php page using the following redirect:
>>>> >>>>>>>>
>>>> >>>>>>>> Options +FollowSymlinks
>>>> >>>>>>>> RewriteEngine on
>>>> >>>>>>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>>>>>>
>>>> >>>>>>>> RewriteRule $ /index.php [R=302,L]
>>>> >>>>>>>>
>>>> >>>>>>>> However the php request headers page always shows the URI as /
>>>> >>>>>>>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>>>>>>> test.html).
>>>> >>>>>>>>
>>>> >>>>>>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>>>>>> something that can be done in PHP or is it apache specific?
>>>> >>>>>>>>
>>>> >>>>>>>
>>>> >>>>>>> Its apache, because it is redirecting, so PHP does only know
>>>> >>>>>>> about the
>>>> >>>>>>> redirected request, and does have no knowledge of how this
>>>> >>>>>>> request
>>>> >>>>>>> reached PHP.
>>>> >>>>>>
>>>> >>>>>> You could try the Proxy flag in the RewriteRule:
>>>> >>>>>>
>>>> >>>>>> RewriteRule $ http://localhost/index.php [P,L]
>>>> >>>>>
>>>> >>>>> He can try a lot of things which won't work.
>>>> >>>>
>>>> >>>> Well, yes, but I didn't think my suggestion was one of them. If you
>>>> >>>> think it is, I would like to know why, so that I would know for the
>>>> >>>> future, rather than just be the target of a bit of sarcasm. You
>>>> >>>> could
>>>> >>>> try something like "That won't work because...." (if applicable).
>>>> >>>>
>>>> >>>> The OP's original rule obviously wouldn't work, because it tells the
>>>> >>>> client browser to generate a completely fresh request with the new
>>>> >>>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> >>>> make Apache proxy the original request to the new location (even to
>>>> >>>> itself if necessary). So the request's original headers should still
>>>> >>>> be present, with perhaps one or more proxy headers.
>>>> >>>>
>>>> >>>> Cheers
>>>> >>>> Tony
>>>> >>>>
>>>> >>>
>>>> >>> It's off topic in this newsgroup. If you want to know why, try an
>>>> >>> appropriate
>>>> >>> newsgroup.
>>>> >>>
>>>> >>
>>>> >> Truth is never off topic.
>>>> >>
>>>> >> /Str.
>>>> >>
>>>> >
>>>> > Only in your small mind. This is a PHP group - hence the "PHP" in
>>>> > its name. There
>>>> > are other groups where experts in that area hang out.
>>>> >
>>>> > And your comment shows why there are so many crappy answers to
>>>> > off-topic questions in
>>>> > this newsgroup.
>>>> >
>>>> Ah, small mind. What could PHP do without Apache servers?
>>> Quite a bit. Apache isn't a requirement for PHP by any means.
>>>
>>>
>> No but then neither is a road for a car, nevertheless I wouldn't
>> normally consider using a car off road ...
> Straw man; the car/road analogy is lacking. There are *other* web servers than
> Apache, such as nginx for example.

Yes, there are.

Nginx usage is in the one percent range according to
http://phpadvent.org/2010/usage-statistics-by-ilia-alshanetsky

I would consider nginx here quite off topic.

/Str.
Re: Apache and php to show http request headers. [message #178513 is a reply to message #178500] Mon, 25 June 2012 19:37 Go to previous messageGo to next message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
On Mon, 25 Jun 2012 19:17:26 +0200, M. Strobel wrote:
> Ah, small mind. What could PHP do without Apache servers?

Heh. If PHP were not intended to be used without a webserver, there
wouldn't need to be gettext or ncurses extensions, would there?

--
_ o
|/)
Re: Apache and php to show http request headers. [message #178514 is a reply to message #178513] Mon, 25 June 2012 20:03 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 25.06.2012 21:37, schrieb Peter H. Coffin:
> On Mon, 25 Jun 2012 19:17:26 +0200, M. Strobel wrote:
>> Ah, small mind. What could PHP do without Apache servers?
>
> Heh. If PHP were not intended to be used without a webserver, there
> wouldn't need to be gettext or ncurses extensions, would there?
>
Hehe. Truth is never off topic.

BTW I am the one posting code here as a screen copy from "php -a".

Would you not agree that at least 90% of php applications run on apache?

/Str.
Re: Apache and php to show http request headers. [message #178515 is a reply to message #178506] Mon, 25 June 2012 20:15 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <jsa8ve$bcc$1(at)news(dot)albasani(dot)net>,
The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:

> Daniel Pitts wrote:

[snip a lot of stuff that should have been snipped before]

> No but then neither is a road for a car, nevertheless I wouldn't
> normally consider using a car off road ...
>
> The clue of course is in the name
>
> "While PHP originally stood for "Personal Home Page", it is now said to
> stand for "PHP: Hypertext Preprocessor"." (wiki)
>
> Frankly I have always felt Produces HHML Pages was nearer the mark.

I use it as a general scripting language, personally, as well as with
apache.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: Apache and php to show http request headers. [message #178516 is a reply to message #178515] Mon, 25 June 2012 20:24 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 25.06.2012 22:15, schrieb Tim Streater:
> In article <jsa8ve$bcc$1(at)news(dot)albasani(dot)net>,
> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>
>> Daniel Pitts wrote:
>
> [snip a lot of stuff that should have been snipped before]
>
>> No but then neither is a road for a car, nevertheless I wouldn't normally consider
>> using a car off road ...
>>
>> The clue of course is in the name
>>
>> "While PHP originally stood for "Personal Home Page", it is now said to stand for
>> "PHP: Hypertext Preprocessor"." (wiki)
>>
>> Frankly I have always felt Produces HHML Pages was nearer the mark.
>
> I use it as a general scripting language, personally, as well as with apache.

Yes, it is "fast enough" if you take care not to have xdebug always loaded.

But I prefer Tcl, it is so easy to quickly set up some input fields and buttons...

/Str.
Re: Apache and php to show http request headers. [message #178517 is a reply to message #178516] Mon, 25 June 2012 20:32 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 4:24 PM, M. Strobel wrote:
> Am 25.06.2012 22:15, schrieb Tim Streater:
>> In article <jsa8ve$bcc$1(at)news(dot)albasani(dot)net>,
>> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>>
>>> Daniel Pitts wrote:
>>
>> [snip a lot of stuff that should have been snipped before]
>>
>>> No but then neither is a road for a car, nevertheless I wouldn't normally consider
>>> using a car off road ...
>>>
>>> The clue of course is in the name
>>>
>>> "While PHP originally stood for "Personal Home Page", it is now said to stand for
>>> "PHP: Hypertext Preprocessor"." (wiki)
>>>
>>> Frankly I have always felt Produces HHML Pages was nearer the mark.
>>
>> I use it as a general scripting language, personally, as well as with apache.
>
> Yes, it is "fast enough" if you take care not to have xdebug always loaded.
>
> But I prefer Tcl, it is so easy to quickly set up some input fields and buttons...
>
> /Str.
>
>

There is no need to have xdebug loaded to use it as a general scripting
language. And it's quite good at it, actually.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Apache and php to show http request headers. [message #178518 is a reply to message #178511] Mon, 25 June 2012 20:33 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 3:32 PM, M. Strobel wrote:
> Am 25.06.2012 19:46, schrieb Daniel Pitts:
>> On 6/25/12 10:17 AM, M. Strobel wrote:
>>> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>>>> On 6/25/2012 12:10 PM, M. Strobel wrote:
>>>> > Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> >> On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>>>> >>> In article <js9pqt$1lm$1(at)dont-email(dot)me>,
>>>> >>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>>> >>>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>>> >>>>> In article <klslb9-ogk(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan> wrote:
>>>> >>>>>> On 25-06-2012 12:15, brumik wrote:
>>>> >>>>>>>
>>>> >>>>>>> I need to test various http requests from an application and am using
>>>> >>>>>>> Apache/PHP on ubuntu to display the http request headers. The
>>>> >>>>>>> application proxy forwards http requests to the apache server's IP
>>>> >>>>>>> address like as follows:
>>>> >>>>>>>
>>>> >>>>>>> 192.168.40.1/test/test.html
>>>> >>>>>>>
>>>> >>>>>>> where 192.168.40.1 is the apache server.
>>>> >>>>>>>
>>>> >>>>>>> I have a php script to dump the headers as follows:
>>>> >>>>>>>
>>>> >>>>>>> <?php
>>>> >>>>>>> foreach($_SERVER as $h=>$v)
>>>> >>>>>>> #if(ereg('HTTP_(.+)',$h,$hp))
>>>> >>>>>>> echo "<li>$h = $v</li>\n";
>>>> >>>>>>> header('Content-type: text/html');
>>>> >>>>>>> ?>
>>>> >>>>>>>
>>>> >>>>>>> The problem is that to show the headers, I redirect 192.168.40.1/* to
>>>> >>>>>>> the above index.php page using the following redirect:
>>>> >>>>>>>
>>>> >>>>>>> Options +FollowSymlinks
>>>> >>>>>>> RewriteEngine on
>>>> >>>>>>> RewriteCond %{REQUEST_URI} !/index.php$
>>>> >>>>>>>
>>>> >>>>>>> RewriteRule $ /index.php [R=302,L]
>>>> >>>>>>>
>>>> >>>>>>> However the php request headers page always shows the URI as /
>>>> >>>>>>> index.php as opposed to the 'original' URI requested (/test/
>>>> >>>>>>> test.html).
>>>> >>>>>>>
>>>> >>>>>>> How can I get it to show the 'original' URI requested? is this
>>>> >>>>>>> something that can be done in PHP or is it apache specific?
>>>> >>>>>>>
>>>> >>>>>>
>>>> >>>>>> Its apache, because it is redirecting, so PHP does only know about the
>>>> >>>>>> redirected request, and does have no knowledge of how this request
>>>> >>>>>> reached PHP.
>>>> >>>>>
>>>> >>>>> You could try the Proxy flag in the RewriteRule:
>>>> >>>>>
>>>> >>>>> RewriteRule $ http://localhost/index.php [P,L]
>>>> >>>>
>>>> >>>> He can try a lot of things which won't work.
>>>> >>>
>>>> >>> Well, yes, but I didn't think my suggestion was one of them. If you
>>>> >>> think it is, I would like to know why, so that I would know for the
>>>> >>> future, rather than just be the target of a bit of sarcasm. You could
>>>> >>> try something like "That won't work because...." (if applicable).
>>>> >>>
>>>> >>> The OP's original rule obviously wouldn't work, because it tells the
>>>> >>> client browser to generate a completely fresh request with the new
>>>> >>> location. In contrast, the Proxy flag in RewriteRule is supposed to
>>>> >>> make Apache proxy the original request to the new location (even to
>>>> >>> itself if necessary). So the request's original headers should still
>>>> >>> be present, with perhaps one or more proxy headers.
>>>> >>>
>>>> >>> Cheers
>>>> >>> Tony
>>>> >>>
>>>> >>
>>>> >> It's off topic in this newsgroup. If you want to know why, try an appropriate
>>>> >> newsgroup.
>>>> >>
>>>> >
>>>> > Truth is never off topic.
>>>> >
>>>> > /Str.
>>>> >
>>>>
>>>> Only in your small mind. This is a PHP group - hence the "PHP" in its name. There
>>>> are other groups where experts in that area hang out.
>>>>
>>>> And your comment shows why there are so many crappy answers to off-topic questions in
>>>> this newsgroup.
>>>>
>>> Ah, small mind. What could PHP do without Apache servers?
>> Quite a bit. Apache isn't a requirement for PHP by any means.
>
> Who is talking about requirement?
>
> The point was JS saying Apache is off topic for PHP, and I tried to hint to the
> importance of Apache for PHP web programming.
>
> see http://phpadvent.org/2010/usage-statistics-by-ilia-alshanetsky
>
> /Str.
>
>
>

That is correct. Apache is off-topic in this newsgroup. Try reading
the charter.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Apache and php to show http request headers. [message #178519 is a reply to message #178514] Mon, 25 June 2012 20:33 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 4:03 PM, M. Strobel wrote:
> Am 25.06.2012 21:37, schrieb Peter H. Coffin:
>> On Mon, 25 Jun 2012 19:17:26 +0200, M. Strobel wrote:
>>> Ah, small mind. What could PHP do without Apache servers?
>>
>> Heh. If PHP were not intended to be used without a webserver, there
>> wouldn't need to be gettext or ncurses extensions, would there?
>>
> Hehe. Truth is never off topic.
>
> BTW I am the one posting code here as a screen copy from "php -a".
>
> Would you not agree that at least 90% of php applications run on apache?
>
> /Str.
>

Nope.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Apache and php to show http request headers. [message #178520 is a reply to message #178514] Mon, 25 June 2012 20:57 Go to previous messageGo to next message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
On Mon, 25 Jun 2012 22:03:51 +0200, M. Strobel wrote:
> Am 25.06.2012 21:37, schrieb Peter H. Coffin:
>> On Mon, 25 Jun 2012 19:17:26 +0200, M. Strobel wrote:
>>> Ah, small mind. What could PHP do without Apache servers?
>>
>> Heh. If PHP were not intended to be used without a webserver, there
>> wouldn't need to be gettext or ncurses extensions, would there?
>>
> Hehe. Truth is never off topic.
>
> BTW I am the one posting code here as a screen copy from "php -a".
>
> Would you not agree that at least 90% of php applications run on apache?

I wouldn't aregue with the figure, but this particular truth belongs to
alt.apache.configuration

--
I didn't need to sabotage anything. Not being around to say "No that
won't work" or "you can't do it that way" is more than enough damage.
(Ego problem? It's not a problem.)
-- Graham Reed, on job endings
Re: Apache and php to show http request headers. [message #178521 is a reply to message #178520] Mon, 25 June 2012 21:32 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 25.06.2012 22:57, schrieb Peter H. Coffin:
> On Mon, 25 Jun 2012 22:03:51 +0200, M. Strobel wrote:
>> Am 25.06.2012 21:37, schrieb Peter H. Coffin:
>>> On Mon, 25 Jun 2012 19:17:26 +0200, M. Strobel wrote:
>>>> Ah, small mind. What could PHP do without Apache servers?
>>>
>>> Heh. If PHP were not intended to be used without a webserver, there
>>> wouldn't need to be gettext or ncurses extensions, would there?
>>>
>> Hehe. Truth is never off topic.
>>
>> BTW I am the one posting code here as a screen copy from "php -a".
>>
>> Would you not agree that at least 90% of php applications run on apache?
>
> I wouldn't aregue with the figure, but this particular truth belongs to
> alt.apache.configuration
>


PHP has an equal part in it.

/str.
Re: Apache and php to show http request headers. [message #178522 is a reply to message #178521] Mon, 25 June 2012 22:11 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 5:32 PM, M. Strobel wrote:
> Am 25.06.2012 22:57, schrieb Peter H. Coffin:
>> On Mon, 25 Jun 2012 22:03:51 +0200, M. Strobel wrote:
>>> Am 25.06.2012 21:37, schrieb Peter H. Coffin:
>>>> On Mon, 25 Jun 2012 19:17:26 +0200, M. Strobel wrote:
>>>> > Ah, small mind. What could PHP do without Apache servers?
>>>>
>>>> Heh. If PHP were not intended to be used without a webserver, there
>>>> wouldn't need to be gettext or ncurses extensions, would there?
>>>>
>>> Hehe. Truth is never off topic.
>>>
>>> BTW I am the one posting code here as a screen copy from "php -a".
>>>
>>> Would you not agree that at least 90% of php applications run on apache?
>>
>> I wouldn't aregue with the figure, but this particular truth belongs to
>> alt.apache.configuration
>>
>
>
> PHP has an equal part in it.
>
> /str.
>

Not at all. That's why there are so many newsgroups.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Apache and php to show http request headers. [message #178523 is a reply to message #178516] Mon, 25 June 2012 22:40 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <a4rvneF88uU1(at)mid(dot)uni-berlin(dot)de>,
"M. Strobel" <sorry_no_mail_here(at)nowhere(dot)dee> wrote:

> Am 25.06.2012 22:15, schrieb Tim Streater:
>> In article <jsa8ve$bcc$1(at)news(dot)albasani(dot)net>,
>> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>>
>>> Daniel Pitts wrote:
>>
>> [snip a lot of stuff that should have been snipped before]
>>
>>> No but then neither is a road for a car, nevertheless I wouldn't normally
>>> consider
>>> using a car off road ...
>>>
>>> The clue of course is in the name
>>>
>>> "While PHP originally stood for "Personal Home Page", it is now said to
>>> stand for
>>> "PHP: Hypertext Preprocessor"." (wiki)
>>>
>>> Frankly I have always felt Produces HHML Pages was nearer the mark.
>>
>> I use it as a general scripting language, personally, as well as with
>> apache.
>
> Yes, it is "fast enough" if you take care not to have xdebug always loaded.

What is xdebug?

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: Apache and php to show http request headers. [message #178524 is a reply to message #178509] Mon, 25 June 2012 23:11 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Luuk wrote:
> On 25-06-2012 20:22, Daniel Pitts wrote:
>> Asking an Apache specific question here is like asking a Windows
>> question on c.l.javascript.
>
> But someone who is working with PHP (or doing thing with it), should
> have basic knowledge about the environment where PHP is running...
>
Unless their name is Jerry.
>
>


--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
Re: Apache and php to show http request headers. [message #178525 is a reply to message #178510] Mon, 25 June 2012 23:14 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
M. Strobel wrote:
> Am 25.06.2012 19:55, schrieb The Natural Philosopher:
>> M. Strobel wrote:
>>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> On 6/25/2012 10:42 AM, Tony Mountifield wrote:


>>>> It's off topic in this newsgroup. If you want to know why, try an appropriate
>>>> newsgroup.
>>>>
>>> Truth is never off topic.
>>>
>> Jerry is always off topic then..
>
> Dead on target.
>
> And he is putting more effort into telling everyone what is off topic than would be
> required to answer the question.
>

Well at least he's a consistent asshole then. He always did. But
remember, he doesn't know the answer. Its not in the PHP manual which is
all he knows about PHP - never having written a line of code in his life.



> /Str.


--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
Re: Apache and php to show http request headers. [message #178526 is a reply to message #178525] Mon, 25 June 2012 23:42 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/25/2012 7:14 PM, The Natural Philosopher wrote:
> M. Strobel wrote:
>> Am 25.06.2012 19:55, schrieb The Natural Philosopher:
>>> M. Strobel wrote:
>>>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>> > On 6/25/2012 10:42 AM, Tony Mountifield wrote:
>
>
>>>> > It's off topic in this newsgroup. If you want to know why, try an
>>>> > appropriate
>>>> > newsgroup.
>>>> >
>>>> Truth is never off topic.
>>>>
>>> Jerry is always off topic then..
>>
>> Dead on target.
>>
>> And he is putting more effort into telling everyone what is off topic
>> than would be
>> required to answer the question.
>>
>
> Well at least he's a consistent asshole then. He always did. But
> remember, he doesn't know the answer. Its not in the PHP manual which is
> all he knows about PHP - never having written a line of code in his life.
>
>
>
>> /Str.
>
>

That's where you're wrong. I know the answer (although YOU don't) - but
I'm not going to encourage off-topic posts in this newsgroup.

But once again you show your stoopidity - I suggest you figure out which
end of a shovel to use so you can go back to ditch digging. We all know
you are neither a programmer nor the electrical engineer you claim to
be. That's why you won't use your real name.

But then trolls are like that.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
xdebug, was Re: Apache and php to show http request headers. [message #178527 is a reply to message #178523] Tue, 26 June 2012 07:27 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 26.06.2012 00:40, schrieb Tim Streater:
> In article <a4rvneF88uU1(at)mid(dot)uni-berlin(dot)de>,
> "M. Strobel" <sorry_no_mail_here(at)nowhere(dot)dee> wrote:
>
>> Am 25.06.2012 22:15, schrieb Tim Streater:
>>> In article <jsa8ve$bcc$1(at)news(dot)albasani(dot)net>,
>>> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>>>> > Daniel Pitts wrote:
>>>> [snip a lot of stuff that should have been snipped before]
>>>> > No but then neither is a road for a car, nevertheless I wouldn't normally >>
>> consider
>>>> using a car off road ...
>>>>
>>>> The clue of course is in the name
>>>>
>>>> "While PHP originally stood for "Personal Home Page", it is now said to >> stand
>> for
>>>> "PHP: Hypertext Preprocessor"." (wiki)
>>>>
>>>> Frankly I have always felt Produces HHML Pages was nearer the mark.
>>>> I use it as a general scripting language, personally, as well as with > apache.
>>
>> Yes, it is "fast enough" if you take care not to have xdebug always loaded.
>
> What is xdebug?

Are you serious?

I use it for interactive remote debugging of web scripts together with my IDE, and it
is a big time saver.

When you install it (xdebug.org), there is a xdebug.ini installed into
/etc/php5/conf.d/ that will be included into your php-CLI as well. It slows your app
down a lot, because it watches all the calls.

/Str.
Re: xdebug, was Re: Apache and php to show http request headers. [message #178528 is a reply to message #178527] Tue, 26 June 2012 08:47 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <a4t6j3FbabU1(at)mid(dot)uni-berlin(dot)de>,
"M. Strobel" <sorry_no_mail_here(at)nowhere(dot)dee> wrote:

> Am 26.06.2012 00:40, schrieb Tim Streater:
>> In article <a4rvneF88uU1(at)mid(dot)uni-berlin(dot)de>,
>> "M. Strobel" <sorry_no_mail_here(at)nowhere(dot)dee> wrote:
>>
>>> Am 25.06.2012 22:15, schrieb Tim Streater:
>>>> In article <jsa8ve$bcc$1(at)news(dot)albasani(dot)net>,
>>>> The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>>>> >> Daniel Pitts wrote:
>>>> > [snip a lot of stuff that should have been snipped before]
>>>> >> No but then neither is a road for a car, nevertheless I wouldn't
>>>> >> normally >>
>>> consider
>>>> > using a car off road ...
>>>> >
>>>> > The clue of course is in the name
>>>> >
>>>> > "While PHP originally stood for "Personal Home Page", it is now said to
>>>> > >> stand
>>> for
>>>> > "PHP: Hypertext Preprocessor"." (wiki)
>>>> >
>>>> > Frankly I have always felt Produces HHML Pages was nearer the mark.
>>>> > I use it as a general scripting language, personally, as well as with
>>>> > > apache.
>>>
>>> Yes, it is "fast enough" if you take care not to have xdebug always
>>> loaded.
>>
>> What is xdebug?
>
> Are you serious?
>
> I use it for interactive remote debugging of web scripts together with my
> IDE, and it is a big time saver.

I guess I haven't needed any such.

> When you install it (xdebug.org), there is a xdebug.ini installed into
> /etc/php5/conf.d/ that will be included into your php-CLI as well. It slows
> your app down a lot, because it watches all the calls.

Hmmm, let's see:

Second-Mini% cd /etc/php5
cd: no such file or directory: /etc/php5

I'll pass thanks, until such time as I have a script I can't figure out.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: Apache and php to show http request headers. [message #178529 is a reply to message #178500] Wed, 27 June 2012 02:36 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
M. Strobel, 25.06.2012 19:17:

[...]
> Ah, small mind. What could PHP do without Apache servers?

A lot. PHP runs fine without Apache and Apache is not the only web
server which supports PHP. nginx is another popular example and even IIS
can be used to host PHP.


--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Re: Apache and php to show http request headers. [message #178530 is a reply to message #178529] Wed, 27 June 2012 08:11 Go to previous messageGo to next message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma: 0
Senior Member
Am 27.06.2012 04:36, schrieb Arno Welzel:
> M. Strobel, 25.06.2012 19:17:
>
> [...]
>> Ah, small mind. What could PHP do without Apache servers?
>
> A lot. PHP runs fine without Apache and Apache is not the only web
> server which supports PHP.

Yea, the SAPI list is quite long.

> nginx is another popular example and even IIS
> can be used to host PHP.
>

Popular is not quite the word, with a market share in the sub percent range.

But I completely agree to "even" ...

/Str.
Re: Apache and php to show http request headers. [message #178531 is a reply to message #178530] Thu, 28 June 2012 11:18 Go to previous messageGo to previous message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
Am 27.06.2012 10:11, schrieb M. Strobel:

> Am 27.06.2012 04:36, schrieb Arno Welzel:
>> M. Strobel, 25.06.2012 19:17:
>>
>> [...]
>>> Ah, small mind. What could PHP do without Apache servers?
>>
>> A lot. PHP runs fine without Apache and Apache is not the only web
>> server which supports PHP.
>
> Yea, the SAPI list is quite long.
>
>> nginx is another popular example and even IIS
>> can be used to host PHP.
>
> Popular is not quite the word, with a market share in the sub percent range.

nginx has a market share of more than 11%:

<http://w3techs.com/technologies/overview/web_server/all>

And if you look at the trend graphs you will see that the usage of
Apache and IIS both decline, while nginx increases - i assume that
people move from Apache/IIS to nginx for good reasons.

And if you don't believe w3techs.com:

< http://news.netcraft.com/archives/2012/01/03/january-2012-web-server-survey .html>

Ok - maybe only a few nginx servers also use PHP - but nginx itself is
popular.

> But I completely agree to "even" ...

Why? The "traditional" platform for IIS hosted applications is C# and
ASP.NET, not PHP.

Also see:

<http://w3techs.com/technologies/overview/programming_language/all>

Since IIS has a market share of 18% but ASP.NET is at about 21% it seems
to be obvious, that most IIS installations don't use PHP and some .NET
applications are hosted in Mono environments.


--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Pages (2): [1  2    »]  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Simulating a Form Method=Post submission in PHP
Next Topic: File upload on iOS
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 03:43:23 GMT 2024

Total time taken to generate the page: 0.03627 seconds