You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Matt Sergeant <ma...@sergeant.org> on 2001/05/22 16:42:15 UTC

mod_php woes...

OK I'm now officially going to go bald with the mod_php vs mod_perl config
directives issues...

Here's a fun gdb output to ponder over:

(gdb) n
513	    for (handp = handlers; handp->hr.content_type; ++handp) {
(gdb) 
514		if (handler_len == handp->len
(gdb) p *handp
$138 = {hr = {content_type = 0x352099 "text/html", 
    handler = 0x2c3790 <php_xbithack_handler>}, len = 9}
(gdb) p *r    
$139 = {pool = 0x8777ecc, connection = 0x8776ebc, server = 0x817c0a4, 
  next = 0x0, prev = 0x8777ef4, main = 0x0, 
  the_request = 0x87785fc "GET / HTTP/1.1", assbackwards = 0, 
  proxyreq = NOT_PROXY, header_only = 0, protocol = 0x877862c "HTTP/1.1", 
  proto_num = 1001, hostname = 0x877882c "localhost", 
  request_time = 990541557, status_line = 0x0, status = 200, 
  method = 0x877860c "GET", method_number = 0, allowed = 0, sent_bodyct =
0, 
  bytes_sent = 0, mtime = 0, chunked = 0, byterange = 0, boundary = 0x0, 
  range = 0x0, clength = 0, remaining = 0, read_length = 0, read_body = 0, 
  read_chunked = 0, expecting_100 = 0, headers_in = 0x877805c, 
  headers_out = 0x87af744, err_headers_out = 0x87af75c, 
  subprocess_env = 0x87af794, notes = 0x87af70c, 
  content_type = 0x87a972c "text/html", handler = 0x0, content_encoding =
0x0, 
  content_language = 0x874d7e4 "en", content_languages = 0x87a96c4, 
  vlist_validator = 0x87af58c "\"3ad87bee\"", no_cache = 0, no_local_copy
= 0, 
  unparsed_uri = 0x8778c14 "/index.html", uri = 0x8778c24 "/index.html", 
  filename = 0x87a9664 "/opt/apache_561/htdocs/index.html.en", 
  path_info = 0x8779044 "", args = 0x0, finfo = {st_dev = 773, __pad1 = 0, 
    st_ino = 80797, st_mode = 33188, st_nlink = 1, st_uid = 501, st_gid =
503, 
    st_rdev = 0, __pad2 = 0, st_size = 1358, st_blksize = 4096, st_blocks
= 8, 
    st_atime = 987266030, __unused1 = 0, st_mtime = 943133380, __unused2 =
0, 
    st_ctime = 987266030, __unused3 = 0, __unused4 = 0, __unused5 = 0}, 
  parsed_uri = {scheme = 0x0, hostinfo = 0x0, user = 0x0, password = 0x0, 
    hostname = 0x0, port_str = 0x0, path = 0x8778c24 "/index.html", 
    query = 0x0, fragment = 0x0, hostent = 0x0, port = 0, is_initialized =
1, 
    dns_looked_up = 0, dns_resolved = 0}, per_dir_config = 0x877915c, 
  request_config = 0x8778c34, htaccess = 0x0, 
  case_preserved_filename = 0x877901c "/opt/apache_561/htdocs/index.html"}
(gdb) n
516	            result = (*handp->hr.handler) (r);
(gdb) s
php_xbithack_handler (r=0x8778aac) at mod_php4.c:679
679		conf = (php_apache_info_struct
*) get_module_config(r->per_dir_config, &php4_module);
(gdb) p *r
$140 = {pool = 0x63203b6c, connection = 0x73726168, server = 0x753d7465, 
  next = 0x322d7363, prev = 0x0, main = 0x0, the_request = 0x0, 
  assbackwards = 0, proxyreq = NOT_PROXY, header_only = 0, protocol = 0x0, 
  proto_num = 0, hostname = 0x0, request_time = 0, status_line = 0x0, 
  status = 0, method = 0x0, method_number = 0, allowed = 0, sent_bodyct =
0, 
  bytes_sent = 0, mtime = 0, chunked = 0, byterange = 0, boundary = 0x0, 
  range = 0x0, clength = 0, remaining = 0, read_length = 0, read_body = 0, 
  read_chunked = 0, expecting_100 = 0, headers_in = 0x0, headers_out =
0x0, 
  err_headers_out = 0x0, subprocess_env = 0x0, notes = 0x0, 
  content_type = 0x0, handler = 0x0, content_encoding = 0x0, 
  content_language = 0x0, content_languages = 0x0, vlist_validator = 0x0, 
  no_cache = 0, no_local_copy = 0, unparsed_uri = 0x0, uri = 0x0, 
  filename = 0x0, path_info = 0x0, args = 0x0, finfo = {st_dev = 0, 
    __pad1 = 0, st_ino = 0, st_mode = 0, st_nlink = 0, st_uid = 0, st_gid
= 0, 
    st_rdev = 0, __pad2 = 0, st_size = 0, st_blksize = 0, st_blocks = 0, 
    st_atime = 0, __unused1 = 0, st_mtime = 0, __unused2 = 0, st_ctime =
0, 
    __unused3 = 0, __unused4 = 0, __unused5 = 0}, parsed_uri = {scheme =
0x0, 
    hostinfo = 0x0, user = 0x0, password = 0x0, hostname = 0x0, 
    port_str = 0x0, path = 0x0, query = 0x0, fragment = 0x0, hostent =
0x0, 
    port = 0, is_initialized = 0, dns_looked_up = 0, dns_resolved = 0}, 
  per_dir_config = 0x0, request_config = 0x0, htaccess = 0x0, 
  case_preserved_filename = 0x0}
(gdb) 

OK, so let me decipher this for those who are crapping themselves at the
above :-)

I'm in httpd_config.c in Apache's core. It's looping through the possible
handlers looking for something to handle this request, where the
content-type is "text/html". It finds PHP's php_xbithack_handler(), which
matches "text/html". The trace above starts from there with a print to
show which handler is getting called.

I've printed the request_rec structure at that point. Everything looks
great. Then it calls into php_xbithack_handler(), passing in that
request_rec...

Now the mystery. As soon as we enter php_xbithack_handler(), the
request_rec has all of it's fields set to NULL!!! (well most of them
anyway). The request_rec is exactly the same request_rec pointer (verified
in the gdb output:

Breakpoint 11, ap_invoke_handler (r=0x8778aac) at
http_config.c:493
...
php_xbithack_handler (r=0x8778aac) at mod_php4.c:679

And yet going into the function has turned things upside down and inside
out!!! HELPPPPP!!! :-)

Should I post this to the httpd list or the php developers list or
something?

-- 
<Matt/>

    /||    ** Founder and CTO  **  **   http://axkit.com/     **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
     \\//
     //\\
    //  \\


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: mod_php woes...

Posted by Brian Aker <br...@tangent.org>.
Matt Sergeant wrote:
 > I'm in httpd_config.c in Apache's core. It's looping through the
possible
> handlers looking for something to handle this request, where the
> content-type is "text/html". It finds PHP's php_xbithack_handler(), which
> matches "text/html". The trace above starts from there with a print to
> show which handler is getting called.
I worked on this a few months ago and found that it was dieing for me
when mod_perl went to go do a scan of the modules configs. For some
reason having both mod_perl and PHP compiled together corrupted the
array_list. An even odder thing was that it only failed if both
has been compiled as DSO.
	-Brian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org