Re: problem: Debian apache2 + php4-cgi + attachments
Moritz Bunkus <[email protected]> Tue, 6 Jan 2004 23:58:50 +0100
| Newsgroups | gmane.comp.bug-tracking.anthill.devel |
|---|---|
| Message-ID | <[email protected]> |
Heya,
me again :)
I haven't been able to get PHP4 working with Apache2 when PHP4 is
compiled as a lib (instead of the CGI variant). Segfaults and
whatnot. So I've investigated further. The problem is that, in the setup
with PHP4 being executed as a CGI script, php4 is being executed but it
cannot find the file in question. This is because it evaluates
PATH_TRANSLATED which gets set by the browser to (in my case)
/home/www/bunkus.org/html/anthill/showattachment.php/21/a.txt while
PATH_INFO contains /anthill/showattachment.php/21/a.txt.
My solution is to replace /usr/lib/cgi-bin/php4 with a small shell
script that cuts off everything after .php and then calls the php4
binary. This is of course a performance hit, but my server is definitely
not THAT busy.
Now I encountered another problem with showattachment.php. As you can
see above PATH_INFO contains the complete path to the script and not
just the parameters /21/a.txt. showattachment.php however expects 21 and
a.txt to be at the start of the array that you get after splitting up on
/. I just modified those two lines like this:
Index: showattachment.php
===================================================================
RCS file: /cvsroot/anthill-0.3/html/showattachment.php,v
retrieving revision 1.11
diff -u -r1.11 showattachment.php
--- showattachment.php 26 Nov 2003 20:17:03 -0000 1.11
+++ showattachment.php 6 Jan 2004 22:57:37 -0000
@@ -28,8 +28,8 @@
}
$f = explode("/",$fname);
-$id = $f[0];
-$fname = $f[1];
+$id = $f[count($f) - 2];
+$fname = $f[count($f) - 1];
$result = $db->query("SELECT * FROM attachidx WHERE atid = $id");
dberror($result);
Perhaps you can commit this to CVS as well? It should not hurt if
PATH_INFO is only set to /21/a.txt, and it will work for me where it is
set to the complete path.
Mosu
--
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds
_______________________________________________
Anthill-workers mailing list
Anthill-workers-+mQDA36h6dWw5LPnMra/[email protected]
http://vmlinuz.ca/mailman/listinfo/anthill-workers
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/+z2pTJ9OsraNuaERApviAJsGpCBwica/kZQ9GcxLW4qKijU1hACeK8qm H/SkXpxqzCsaV2Keco9mQuY= =e2zb -----END PGP SIGNATURE-----