You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by David Ford <da...@blue-labs.org> on 2002/02/04 23:20:25 UTC

Apache2 and php

What does apache2 need in httpd.conf to properly shunt php files through 
the php engine before serving them?

Apparently it needs more than just Load libphp4.so

Note, I'm using php 4.1.1 with httpd_2_0 HEAD.

Thank you,
David



Re: Apache2 and php

Posted by David Ford <da...@blue-labs.org>.
In further trial and error, even that is wrong. You must have both the 
AddType directive as well as the Filter section when trying to use php 
with Apache2.

Now that I have the php engine going, I need to find and fix a segfault. 
I installed phpSysInfo 1.9 in default state. Two things happen.

a) segfault when index.php is loaded and a new child is formed which 
then serves the page
b) if i try to change the template theme, httpd gobbles memory as fast 
as it can before the OOM killer slaps it sideways.

(gdb) bt
#0 0x080989a0 in ap_save_brigade (f=0x81cbd20, saveto=0x81c8304,
b=0xbffff364, p=0x81c79e0) at util_filter.c:473
#1 0x402785e0 in php_output_filter (f=0x81cbd20, bb=0x81cbe80)
at sapi_apache2.c:330
#2 0x0809891a in ap_pass_brigade (next=0x81cbd20, bb=0x81cbe80)
at util_filter.c:445
#3 0x0809eff6 in default_handler (r=0x81c7a18) at core.c:2992
#4 0x0808df56 in ap_run_handler (r=0x81c7a18) at config.c:185
#5 0x0808e3f1 in ap_invoke_handler (r=0x81c7a18) at config.c:359
#6 0x08075569 in ap_process_request (r=0x81c7a18) at http_request.c:290
#7 0x08071a49 in ap_process_http_connection (c=0x818df10) at http_core.c:287
---Type <return> to continue, or q <return> to quit---
#8 0x08096dd6 in ap_run_process_connection (c=0x818df10) at connection.c:86
#9 0x0808ca57 in child_main (child_num_arg=1) at prefork.c:717
#10 0x0808cc00 in make_child (s=0x818cce0, slot=1) at prefork.c:807
#11 0x0808cde5 in perform_idle_server_maintenance (p=0x81003b8)
at prefork.c:948
#12 0x0808d31f in ap_mpm_run (_pconf=0x81003b8, plog=0x8138498, s=0x818cce0)
at prefork.c:1105
#13 0x08091f19 in main (argc=1, argv=0xbffff6a4) at main.c:501

(gdb) p *e
$2 = {link = {next = 0x819de98, prev = 0x81f4248}, type = 0x814a5e8,
length = 136101408, start = 136101504, data = 0x80a9e00,
free = 0x80a9e00 <brigade_cleanup>}

(gdb) p rv
$3 = 1094927173
(gdb) p /x rv
$4 = 0x41434345

(gdb) p *f
$6 = {frec = 0x8186e08, ctx = 0x0, next = 0x81cbd58, r = 0x81c7a18,
c = 0x818df10}
(gdb) p *saveto
$8 = (apr_bucket_brigade *) 0x41434345
(gdb) p **b
$9 = {p = 0x81c79e0, list = {next = 0x819de98, prev = 0x81f4248}}
(gdb) p *p
$10 = {parent = 0x818de08, child = 0x0, sibling = 0x0, ref = 0x818de0c,
cleanups = 0x81cbe90, subprocesses = 0x0, abort_fn = 0, user_data = 0x0,
tag = 0x0, allocator = 0x8153108, active = 0x81cba70, self = 0x81c79d0,
self_first_avail = 0x81c7a18 "?y\034\b\020?\030\b??\030\b"}

Again, your indulgence in helping is appreciated. This is HEAD of httpd2 
and php 4.1.1. php42 HEAD simply does not work,

David


David Ford wrote:

> My apologies, I realized that after I sent it. Actually that is 
> incorrect. This seems to be a fairly unknown answer as nobody was able 
> to answer it for me in the past on either the php or apache groups.
>
> http://marc.theaimsgroup.com/?l=php-dev&m=101180222102820&w=2 
> <http://marc.theaimsgroup.com/?l=php-dev&m=101180222102820&w=2>
>
>/you must replace :
>
>LoadModule php4_module modules/libphp4.so
>AddType application/x-httpd-php .php
>
>By
>
>LoadModule php4_module modules/libphp4.so
><Files *.php>
>SetOutputFilter PHP
>SetInputFilter PHP
></Files>/
>
> Thank you,
> David 




Re: Apache2 and php

Posted by David Ford <da...@blue-labs.org>.
In further trial and error, even that is wrong. You must have both the 
AddType directive as well as the Filter section when trying to use php 
with Apache2.

Now that I have the php engine going, I need to find and fix a segfault. 
I installed phpSysInfo 1.9 in default state. Two things happen.

a) segfault when index.php is loaded and a new child is formed which 
then serves the page
b) if i try to change the template theme, httpd gobbles memory as fast 
as it can before the OOM killer slaps it sideways.

(gdb) bt
#0 0x080989a0 in ap_save_brigade (f=0x81cbd20, saveto=0x81c8304,
b=0xbffff364, p=0x81c79e0) at util_filter.c:473
#1 0x402785e0 in php_output_filter (f=0x81cbd20, bb=0x81cbe80)
at sapi_apache2.c:330
#2 0x0809891a in ap_pass_brigade (next=0x81cbd20, bb=0x81cbe80)
at util_filter.c:445
#3 0x0809eff6 in default_handler (r=0x81c7a18) at core.c:2992
#4 0x0808df56 in ap_run_handler (r=0x81c7a18) at config.c:185
#5 0x0808e3f1 in ap_invoke_handler (r=0x81c7a18) at config.c:359
#6 0x08075569 in ap_process_request (r=0x81c7a18) at http_request.c:290
#7 0x08071a49 in ap_process_http_connection (c=0x818df10) at http_core.c:287
---Type <return> to continue, or q <return> to quit---
#8 0x08096dd6 in ap_run_process_connection (c=0x818df10) at connection.c:86
#9 0x0808ca57 in child_main (child_num_arg=1) at prefork.c:717
#10 0x0808cc00 in make_child (s=0x818cce0, slot=1) at prefork.c:807
#11 0x0808cde5 in perform_idle_server_maintenance (p=0x81003b8)
at prefork.c:948
#12 0x0808d31f in ap_mpm_run (_pconf=0x81003b8, plog=0x8138498, s=0x818cce0)
at prefork.c:1105
#13 0x08091f19 in main (argc=1, argv=0xbffff6a4) at main.c:501

(gdb) p *e
$2 = {link = {next = 0x819de98, prev = 0x81f4248}, type = 0x814a5e8,
length = 136101408, start = 136101504, data = 0x80a9e00,
free = 0x80a9e00 <brigade_cleanup>}

(gdb) p rv
$3 = 1094927173
(gdb) p /x rv
$4 = 0x41434345

(gdb) p *f
$6 = {frec = 0x8186e08, ctx = 0x0, next = 0x81cbd58, r = 0x81c7a18,
c = 0x818df10}
(gdb) p *saveto
$8 = (apr_bucket_brigade *) 0x41434345
(gdb) p **b
$9 = {p = 0x81c79e0, list = {next = 0x819de98, prev = 0x81f4248}}
(gdb) p *p
$10 = {parent = 0x818de08, child = 0x0, sibling = 0x0, ref = 0x818de0c,
cleanups = 0x81cbe90, subprocesses = 0x0, abort_fn = 0, user_data = 0x0,
tag = 0x0, allocator = 0x8153108, active = 0x81cba70, self = 0x81c79d0,
self_first_avail = 0x81c7a18 "?y\034\b\020?\030\b??\030\b"}

Again, your indulgence in helping is appreciated. This is HEAD of httpd2 
and php 4.1.1. php42 HEAD simply does not work,

David


David Ford wrote:

> My apologies, I realized that after I sent it. Actually that is 
> incorrect. This seems to be a fairly unknown answer as nobody was able 
> to answer it for me in the past on either the php or apache groups.
>
> http://marc.theaimsgroup.com/?l=php-dev&m=101180222102820&w=2 
> <http://marc.theaimsgroup.com/?l=php-dev&m=101180222102820&w=2>
>
>/you must replace :
>
>LoadModule php4_module modules/libphp4.so
>AddType application/x-httpd-php .php
>
>By
>
>LoadModule php4_module modules/libphp4.so
><Files *.php>
>SetOutputFilter PHP
>SetInputFilter PHP
></Files>/
>
> Thank you,
> David 




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache2 and php

Posted by Daniel Lopez <da...@covalent.net>.
> 
> /you must replace :
> 
> LoadModule php4_module modules/libphp4.so
> AddType application/x-httpd-php .php

Actually, both approaches should work. Although PHP is implemented as a
filter, when you do the AddType application/x-httpd-php .php, it will insert
itself in the filter chain. You can also do it explictly as you described below:

> By
> 
> LoadModule php4_module modules/libphp4.so
> <Files *.php>
> SetOutputFilter PHP
> SetInputFilter PHP
> </Files>/
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache2 and php

Posted by David Ford <da...@blue-labs.org>.
My apologies, I realized that after I sent it.  Actually that is 
incorrect.  This seems to be a fairly unknown answer as nobody was able 
to answer it for me in the past on either the php or apache groups.

http://marc.theaimsgroup.com/?l=php-dev&m=101180222102820&w=2 
<http://marc.theaimsgroup.com/?l=php-dev&m=101180222102820&w=2>

/you must replace :

LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php

By

LoadModule php4_module modules/libphp4.so
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>/

Thank you,
David

Daniel Lopez wrote:

>This question should be directed to the users@httpd.apache.org list
>
>You need to add the following:
>AddType application/x-httpd-php .php
>
>Daniel
>
>On Mon, Feb 04, 2002 at 05:20:25PM -0500, David Ford wrote:
>
>>What does apache2 need in httpd.conf to properly shunt php files through 
>>the php engine before serving them?
>>
>>Apparently it needs more than just Load libphp4.so
>>
>>Note, I'm using php 4.1.1 with httpd_2_0 HEAD.
>>
>>Thank you,
>>David
>>
>>


Re: Apache2 and php

Posted by David Ford <da...@blue-labs.org>.
My apologies, I realized that after I sent it.  Actually that is 
incorrect.  This seems to be a fairly unknown answer as nobody was able 
to answer it for me in the past on either the php or apache groups.

http://marc.theaimsgroup.com/?l=php-dev&m=101180222102820&w=2 
<http://marc.theaimsgroup.com/?l=php-dev&m=101180222102820&w=2>

/you must replace :

LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php

By

LoadModule php4_module modules/libphp4.so
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>/

Thank you,
David

Daniel Lopez wrote:

>This question should be directed to the users@httpd.apache.org list
>
>You need to add the following:
>AddType application/x-httpd-php .php
>
>Daniel
>
>On Mon, Feb 04, 2002 at 05:20:25PM -0500, David Ford wrote:
>
>>What does apache2 need in httpd.conf to properly shunt php files through 
>>the php engine before serving them?
>>
>>Apparently it needs more than just Load libphp4.so
>>
>>Note, I'm using php 4.1.1 with httpd_2_0 HEAD.
>>
>>Thank you,
>>David
>>
>>


Re: Apache2 and php

Posted by Daniel Lopez <da...@covalent.net>.
This question should be directed to the users@httpd.apache.org list

You need to add the following:
AddType application/x-httpd-php .php

Daniel

On Mon, Feb 04, 2002 at 05:20:25PM -0500, David Ford wrote:
> What does apache2 need in httpd.conf to properly shunt php files through 
> the php engine before serving them?
> 
> Apparently it needs more than just Load libphp4.so
> 
> Note, I'm using php 4.1.1 with httpd_2_0 HEAD.
> 
> Thank you,
> David
> 
>