ForceType forces PHP4?

software development

#1

Hello everyone.

I have PHP5 enabled on a domain of mine.
It is DreamHost’s php5, not my own compile.

I created a php script to generate an image, and named it xml.png
I gave it a .png extension because I can’t trick phpBB into displaying files with a non-image like extension.

So what I did was I named it xml.png and added the following to my .htaccess:

ForceType application/x-httpd-php

But apparently, that makes the PHP4 binary parse the xml.png file, which in turn errors because simplexml does not exist in PHP4 -_-.

This is quite unexpected, is it a problem with the Type setting? application/x-httpd-php5 ?
Or a ceveat of php-cgi?

Can anyone give me a solution?
Thanks.


#2

Anyone find a solution to this?

I have just changed a domain to PHP5 and have this in my .htaccess:
AddType php-cgi .zdz .inc

When I do phpinfo with a .zdz file, I get the php4 binary but with the .php extension, I get php5.

I’ve tried:
AddType php5-cgi .zdz .inc
and
AddType php-cgi5 .zdz .inc
with no success.

Sure would like to get this working so I don’t have to change all my files extensions. :slight_smile:

Any ideas or solutions?
Thanks.


#3

In case it helps, this is what I did to get around the problem:

In .htaccess:

Options +MultiViews

And then I named the file as 'filename.png.php’
I can access it with http://domain.com/filename.png now

Multiviews lets apache decide what file you wanted, if you omit the extension altogether and only give a filename, it will seek it out and give it to you.

Be warned though that this carries certain security implications.


#4

Don’t know if something changed or what but
AddType php5-cgi .zdz .inc
now works.


#5

Ran into the issue where for some reason a:

ForceType application/x-httpd-php

was working until we installed Word Press on the server. We did some testing and found that apache was running PHP 4 for that mime type. So submitted a ticket. Support got back and told us that the mime type is for PHP 4 and that for PHP 5 we should use:

ForceType php5-cgi

Works now. Though not clear in their answer why something that had been working suddenly stopped working after we installed Word Press.