[php-maint] Bug#491928: libapache2-mod-php5: AddType directive misusage
Andrey
cmr.Pent at gmail.com
Tue Jul 22 20:06:33 UTC 2008
Package: libapache2-mod-php5
Version: 5.2.6-2
Severity: important
File: /etc/apache2/mods-available/php5.conf
Hello maintainer!
I've just spent some 2 hours trying to find out why no PHP script
works for me. It kept failing with a cryptic Apache log message:
Premature end of script headers: example.php
It appears that the problem was in
/etc/apache2/mods-available/php5.conf:
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
When I replaced AddType directives with AddHandler directives,
everything started to work nicely:
<IfModule mod_php5.c>
AddHandler application/x-httpd-php .php .phtml .php3
AddHandler application/x-httpd-php-source .phps
</IfModule>
I'm not an Apache nor PHP expert, so let a more a more competent
people speak for me (excerpt from
http://wooga.drbacchus.com/why-we-dont-like-php):
AddType associates a Content-Type with a file extension, and that
tells the browser how to deal with a particular data
stream. AddHandler, on the other hand, maps a handler to a file
extension.
Stated more simply, AddType tells the browser what to do with a
file, and AddHandler tells the server what to do with a file. PHP is
handled by the *server*, not by the browser, and so AddHandler is
more appropriate.
Please correct me if I'm wrong but it seems that we should really use
AddHandler directives there, not AddType.
I'm ready to provide any additional info.
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (1000, 'testing'), (200, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.24-1-486
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libapache2-mod-php5 depends on:
ii apache2-mpm-prefork 2.2.9-5 Apache HTTP Server - traditional n
ii apache2.2-common 2.2.9-5 Apache HTTP Server common files
ii libbz2-1.0 1.0.5-0.1 high-quality block-sorting file co
ii libc6 2.7-10 GNU C Library: Shared libraries
ii libcomerr2 1.40.11-1 common error description library
ii libdb4.6 4.6.21-8 Berkeley v4.6 Database Libraries [
ii libkrb53 1.6.dfsg.4~beta1-3 MIT Kerberos runtime libraries
ii libmagic1 4.24-4 File type determination library us
ii libpcre3 7.4-1+lenny2 Perl 5 Compatible Regular Expressi
ii libssl0.9.8 0.9.8g-10.1 SSL shared libraries
ii libxml2 2.6.32.dfsg-2 GNOME XML library
ii mime-support 3.44-1 MIME files 'mime.types' & 'mailcap
ii php5-common 5.2.6-2 Common files for packages built fr
ii tzdata 2008c-1 time zone and daylight-saving time
ii ucf 3.007 Update Configuration File: preserv
ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime
libapache2-mod-php5 recommends no packages.
-- no debconf information
More information about the pkg-php-maint
mailing list