DreamHost Web Hosting
Discussion Forum


Forums
   >> General Troubleshooting
*Threaded Mode

Subject Make PHP interpret other files...  
Posted byGrimReapa (DH New User )
Posted on10/09/06 02:28 AM



is it possible to use an .htaccess file to make the PHP interpreter parse other file extensions, like PNG for example...

(the file itself is obviously written in PHP, but I just need it to be interpreted like a normal .php file)



Subject Re: Make PHP interpret other files... new [re: GrimReapa]  
Posted byRaz2133 (DH DreamNinja)
Posted on10/09/06 06:02 AM



In reply to:

is it possible to use an .htaccess file to make the PHP interpreter parse other file extensions


Yes. For example, to parse .html and .htm files, just include a line similar to the following in your .htaccess file.

For PHP 4...

AddHandler php-cgi .html .htm

For PHP 5...

AddHandler php5-cgi .html .htm

Mark


--
Save $50 on DreamHost hosting using promo code SAVEMONEY ( Click for promo code details )

Subject Re: Make PHP interpret other files... new [re: Raz2133]  
Posted byGrimReapa (DH New User )
Posted on10/09/06 06:27 AM



Awesome, thanks for your help! :)



Subject Re: Make PHP interpret other files... new [re: GrimReapa]  
Posted bypangea33 (DH Enthusiast)
Posted on10/09/06 08:42 PM



Yikes! Someone by the name of GrimReapa looking to enable executable image files. *Shivers*

I hope Firefox handles unrecognized file content with discretion. What's your website? I'd like to not go there.

Just Kidding. I think....

http://benconley.net
http://teamshocker.com


Subject Re: Make PHP interpret other files... new [re: pangea33]  
Posted byRaz2133 (DH DreamNinja)
Posted on10/09/06 09:03 PM



In reply to:

Yikes! Someone by the name of GrimReapa looking to enable executable image files. *Shivers*


Hey, I didn't think of it from that angle, I guess I am now an accessory

Mark

--
Save $50 on DreamHost hosting using promo code SAVEMONEY ( Click for promo code details )

Subject Re: Make PHP interpret other files... new [re: pangea33]  
Posted byseiler (DH Grizzled Veteran)
Posted on10/10/06 00:25 AM



Well, if it executes as PHP, it could only do what a regular PHP file can do. If it generates an image, the code is done and the saved image isn't going to run any php. Kinda like saving the output of a PHP page as plain static HTML.

Not sure what the purpose would be though, since you can just link to a PHP file as an image, then set the content-type accordingly--like a random image script does.

Also, I'm not sure regular images would display correctly if PHP is trying to handle them like a PHP script that has been renamed to .jpg/gif/etc. I'll have to play around with that one of these days when I'm not too busy being lazy. ;)


--------------------------------------------------------
Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.



*Threaded Mode
Jump to