Stephan Gloor wrote:

Thanks, this is the current configuration we use. Generally, php works, but
the browser randomly shows the php source instead of the generated output.
The system is running on Linux with kernel  2.4.20.
Thanks and regards,
Stephan


"Cool Moe" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED]

Stephan,

Please don't be insulted by this, but is the PHP
module listed in your httpd.conf file?  In Apache2 you
need to have:
LoadModule php4_module modules/libphp4.so

whereas in Apache 1.3 you had to LoadModule AND
AddModule.

Also, I split my add type parameters up (this
shouldn't be a problem, but who knows?):

AddType application/x-httpd-php .php
AddType application/x-httpd-php .inc

What hardware platform and operating system are you
using?

CM

--- Stephan Gloor <[EMAIL PROTECTED]> wrote:

Hello.

Randomly the php-source is displayed instead of the
output
(http://www.engstringen.ch/).
This was the case when having installed apache 1.3
und php 4.1.

After ugrading to apache 2 and php 4.3.4 the bug
still occurs. But the
browser shows now a file download dialog box for
downloading the php
-script instead of having executed it !!!
The header of the response contains the php - mime
type configured
application/x-httpd-php.

The apache config contains
AddType application/x-httpd-php .php .php4 .php3
.phtml
AddType application/x-httpd-php-source .phps
Include conf/confixx_vhost.conf

The confixx_vhost.conf contains lots of virtual host
configured on a
named vhost basis.

php is minimally configured with
'./configure' '--with-mysql' '--with-apxs'

Linux version Linux 2.4.20.

Thanks for any hint
Stephan

I assume its a typo and your configure line for Apache 2 has "--with-apxs2" not "--with-apxs" or this is from your Apache 1.3.x configure. With Apache 2 either the AddType or Filter can be used. My RedHat 9 in /etc/httpd/conf.d/php.conf has:
LoadModule php4_module modules/libphp4.so
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 524288
</Files>
DirectoryIndex index.php
Whereas my Fedore Core 1 (effectively RedHat 10) has:
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php
DirectoryIndex index.php


If your browser is getting the "application/x-httpd-php" header then that indicates the AddType line is present (telling the server that any file with the extension .php is to be sent with the "application/x-httpd-php" HTTP header). It also indicates that the server is simply sending the file out without processing the php first. This means the server has not been told to do so. I think this shows the LoadModule is missing but AddType is present. You need either LoadModule and AddType, or LoadModule and the Filter statements.

If a browser gets a mime type that it does not know what to do with then it is usual to offer the file for download. With a header of "application/x-httpd-php" getting to your browser, this is what I would expect. In your Apache 1.3.x case when it was showing the php source, I suspect it was getting a "text/plain" or "text/html" header and the AddType line was not present.

With Apache 2, I assume you are using it in prefork mode (recommended for php). As root a "httpd -l" should show "prefork.c" as well as "mod_so.c".

Hope this helps.

Chris

Reply via email to