This Forum Has Been Archived
*Click Here To Visit The NEW Forum*



Run .jpg extension as .php

Designing your own website? Need help? Ask your questions and share your favorite resources here... Tables, Forms, Color Scheme & Layout, Scripts, Programs & Resources

Moderators: angienewton, tknoppe, terrapin719, lisamariemary

Run .jpg extension as .php

Postby ramonas001 » Sun Jun 14, 2009 8:16 am

Hey Guys,

I want my php code to run with the file type extension of .jpg.

By this i mean I save my php script with a jpg extension.

I have added this code to my .htaccess file

Code: Select all
<Files spacer.jpg>
ForceType application/x-httpd-php

But it didn't work. Is the code right? I wonder if my host could be blocking this perhaps?

Any help would be greatly appreciated.

Posts: 2
Joined: Sun Feb 22, 2009 1:43 am

Postby terrapin719 » Sun Jun 14, 2009 1:13 pm

I don't think I understand your question. jpg is an image file, and php is is not, so they are very different extensions. I'm going to send the link for this question to a few of our more php knowledgeable members so they can respond.
User avatar
Elite Member
Posts: 1082
Joined: Thu Jul 07, 2005 2:15 pm
Location: Floating away.....

Postby Angela » Sun Jun 14, 2009 2:18 pm

Have you tried this:

Code: Select all
AddType application/x-httpd-php .jpg

....or for a single page

Code: Select all
<Files yourpage.jpg> AddType application/x-httpd-php .jpg </Files>

Although I assume most places would block it because you could use it to do some very malicious things....
User avatar
Posts: 4
Joined: Tue Apr 28, 2009 1:48 pm
Location: WI

Postby bo2o » Sun Jun 21, 2009 8:14 am

You could too use in httpd.conf file adding the .jpg extenssion on:

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

All jpg files it would post process as it were PHP files, but it have the inconvenience that all jpg files are going to postprocess, a solution is to host into a dedicated server of images, and put this
Posts: 4
Joined: Mon Nov 03, 2008 11:43 am

Return to HTML, Web Design & Programming

Who is online

Users browsing this forum: No registered users and 1 guest