php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27580 AddType application/x-httpd-php .html and apache2 log errors
Submitted: 2004-03-12 11:21 UTC Modified: 2004-03-16 17:29 UTC
From: phasma at labs dot cryptosecurity dot org Assigned:
Status: Closed Package: Apache2 related
PHP Version: 4CVS-2004-03-15 OS: linux
Private report: No CVE-ID:
 [2004-03-12 11:21 UTC] phasma at labs dot cryptosecurity dot org
Description:
------------
hi,

i added "AddType application/x-httpd-php .html" to serve php through .html files, but i got a strange errors:

when i try to open a .html page that does not exist, i retrive a 404 error, but in the vhost error logs i don't see anything; and i see a "script not found or unable to stat" in the general apache error log file.

--- snif from general error_log
[Fri Mar 12 17:00:15 2004] [notice] Digest: generating secret for digest authentication ...
[Fri Mar 12 17:00:15 2004] [notice] Digest: done
[Fri Mar 12 17:00:16 2004] [notice] Apache configured -- resuming normal operations
script not found or unable to stat
script not found or unable to stat
script not found or unable to stat
--- snif from general error_log

i noted also that apache2 fails to restart sometimes. better: when i try "apache2 restart" sometimes apache2 starts only one istance (as root) and not spawn threads (as apache user). when this occurs, the only way i found to get all working is to reboot the system.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-13 07:39 UTC] phasma at labs dot cryptosecurity dot org
System:

apache2 2.0.48
php 4.3.4
mod_php 4.3.4

php compile option:

'--with-apxs2=/usr/sbin/apxs2' '--with-ndbm=/usr' '--with-db4=/usr' '--with-mcrypt=/usr' '--with-mhash=/usr'
'--without-interbase' '--without-ming' '--without-swf' '--without-sybase' '--with-gdbm=/usr'
'--with-java=/opt/blackdown-jdk-1.4.1' '--without-mcal' '--without-unixODBC' '--with-pgsql=/usr'
'--without-snmp' '--with-pdflib=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-png=/usr'
'--with-png-dir=/usr' '--with-jpeg=/usr' '--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff=/usr'
'--with-tiff-dir=/usr' '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock'
'--with-freetype-dir=/usr' '--with-ttf=/usr' '--with-t1lib=/usr' '--with-gettext' '--without-qtdom'
'--with-pspell=/usr' '--with-openssl=/usr' '--with-imap=/usr' '--without-ldap' '--with-dom=/usr'
'--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--without-kerberos' '--with-pam' '--disable-memory-limit'
'--disable-ipv6' '--without-yaz' '--without-curl' '--enable-dbx' '--with-imap-ssl' '--with-zlib=/usr'
'--with-zlib-dir=/usr' '--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot' '--with-xmlrpc'
'--enable-wddx' '--with-xml' '--enable-mbstring=all' '--enable-mbregex' '--with-bz2=/usr' '--with-crack=/usr'
'--with-cdb' '--enable-pcntl' '--enable-bcmath' '--enable-calendar' '--enable-dbase' '--enable-filepro'
'--enable-ftp' '--with-mime-magic' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvipc'
'--with-iconv' '--enable-shmop' '--enable-dio' '--enable-yp' '--without-ncurses' '--without-readline'
'--enable-inline-optimization' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning'
'--with-config-file-path=/etc/php/apache2-php4'


MY NEEDS

To serve php code in html file

WHAT I DID

I added "AddType application/x-httpd-php .html" in the php module mime define:

<IfModule mod_mime.c>
     AddType application/x-httpd-php .php
     AddType application/x-httpd-php .phtml
     AddType application/x-httpd-php .php3
     AddType application/x-httpd-php .php4
     AddType application/x-httpd-php .html
     AddType application/x-httpd-php-source .phps
</IfModule>

and commented out html in mime.types:

#text/html                      html htm
text/html                       htm

RESULTS

I can serve php code in html pages.

ERRORS

Whenever i browse for a non-existent page with extension .php .phtml .php3 .php4 .html .phps i got a 404
error not found from apache and a "script not found or unable to stat" in apache log errors.

EXAMPLE

browsing http://www.vhost1.com/existent.php (.html, .php3, .php4,...)

--> see the page on my browser
--> see the access log in logs/vhost1/access_log
--> all fine

browsing http://www.vhost1.com/non-existent.php (.html, .php3, .php4,...)

--> see 404 page on my browser
--> see "GET /non-existent.php HTTP/1.1" 404 210 "-" in logs/vhost1/access_log
--> see nothing in logs/vhost1/error_log (i might see "page not found"..)
--> see "script not found or unable to stat" in my general apache2 error logs


It is also a strange log entry, cause a normal entry would be:

[Sat Mar 13 12:01:23 2004] [error] [client xxx.xxx.xxx.xxx] script not found or unable to stat

and generally i could see also the referer error' script but i see only:

script not found or unable to stat


The other strange is that:

Apache has begun to crash when restarted since these log errors has appered.
It occurs randomly, and i can't reproduce the crash systematically.

The only i can show is:

Normal restart:

from apache log:

[Sat Mar 13 00:45:30 2004] [notice] caught SIGTERM, shutting down
[Sat Mar 13 00:45:33 2004] [notice] Digest: generating secret for digest authentication ...
[Sat Mar 13 00:45:33 2004] [notice] Digest: done
[Sat Mar 13 00:45:34 2004] [notice] Apache configured -- resuming normal operations
...

from ps aux|grep apache

root     14886  0.0  0.6 24624 12512 ?       S    00:56   0:16 /usr/sbin/apache2 -k start -D PHP4
apache   23696  0.0  0.7 24896 13180 ?       S    13:29   0:00 /usr/sbin/apache2 -k start -D PHP4
apache   13738  0.0  0.6 24756 12664 ?       S    13:32   0:00 /usr/sbin/apache2 -k start -D PHP4
apache   31334  0.0  0.7 24772 13076 ?       S    13:35   0:00 /usr/sbin/apache2 -k start -D PHP4
apache    4519  0.0  0.7 24772 13008 ?       S    13:35   0:00 /usr/sbin/apache2 -k start -D PHP4
apache   20968  0.0  0.7 24772 13008 ?       S    13:35   0:00 /usr/sbin/apache2 -k start -D PHP4
apache    8220  0.0  0.7 24756 12996 ?       S    13:35   0:00 /usr/sbin/apache2 -k start -D PHP4


Failure restart

[Sat Mar 13 00:45:30 2004] [notice] caught SIGTERM, shutting down
[Sat Mar 13 00:45:33 2004] [notice] Digest: generating secret for digest authentication ...

from ps aux|grep apache

root     14886  0.0  0.6 24624 12512 ?       S    00:56   0:16 /usr/sbin/apache2 -k start -D PHP4


Seems apache doesn't start to spawn his threads.

This is from apache conf:

<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients         150
MaxRequestsPerChild  0
</IfModule>

Yes, i use that for apache'process.

When this occurs, i try to kill, stop, start, restart the daemon, but nothing works.
The only solutions is reboot the system.



I search a lot around the web from a similar occurrence, but i don't found nothing interensting.

Can u help me someway?

Thanks in advance

ph
 [2004-03-14 22:08 UTC] phasma at labs dot cryptosecurity dot org
ok, i downloaded http://snaps.php.net/php4-STABLE-200403150230.tar.bz2, and installed it, but i get the same results.

Addition:
i upgrade my kernel to 2.4.25 from 2.4.24 two days ago, and apache doesn't crash for now.

Still remains the problem about .html .php .php3 .php4 process that give the error "no script found or unable to stat" when the file doesn't exist.

Tnx

ph
 [2004-03-16 17:29 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 03:01:55 2014 UTC