sample.php.html
.(CentOS5 and RHEL5 have Apace v2.2.x.)
It took me a while to figure it out, but it's due to an odd feature of Apache which honors multiple extensions in filename. RHEL5 does an
AddHandler php5-script .php
which tells Apache to run all files with a .php extension through the PHP5 interpreter. I didn't know this, but it even does this for files with names like sample.php.html
, where .php isn't at the end of the filename. So even though the phpdoc output files should just render as HTML, they were being interpretted as PHP and were throwing errors.So I created a directory called
/var/www/html/phpdoc
and added the following to /etc/httpd/conf.d/php.conf
in a Directory
container (and restarted Apache): RemoveHandler .php
That convinced Apache not to run any files in that directory through the PHP5 interpreter. Incidentally, I had previously tried
SetHandler default-handler
for that directory, and it disabled PHP5, but it also disabled nice things like autoindexing (which broke URLs like http://localhost/phpdoc/sample/
: Apache would refuse to serve a directory).By the way, this doesn't seem to affect CentOS4/RHEL4 (Apache 2.0.x and PHP4), because Apache sets up PHP a little differently: it does an
AddType
, so there's no conflict of having both a text/html
content type and a PHP5 handler.
No comments:
Post a Comment