combining asp and php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

combining asp and php?

Post by d3ad1ysp0rk »

not to be stupid or anything.. but if you set your .htaccess file to:

Code: Select all

# Make all ASP code look like PHP
AddType application/x-httpd-asp .php
would that allow you to use asp and php at the same time? or can you already do that? or am i just dreaming? :P
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

no, the line

Code: Select all

AddType application/x-httpd-php .php
tells apache that the request of a file having the extension .php shall be treated as mime-type application/x-httpd-php. Now take a look at

Code: Select all

Action application/x-httpd-php "/php/php.exe"
or

Code: Select all

AddModule mod_php4.c
The first assigns the mime-type to the cgi exe (if you've installed php as cgi) the latter loads the php-module which registers itself as a handler for application/x-httpd-php.
Now if a request is incoming, apache determines the mime-type. In case of a php-script (and a properly configured webserver) the request is handled as application/x-httpd-php. Now apache searches for a handler of some kind to deal with application/x-httpd-php and (hopefully) finds either the php cgi executable or the php module.
Long story, short conclusion:
you obviously want to have files handled by php even if they have the extension .asp

Code: Select all

AddType application/x-httpd-php .asp .php
and you're done
Post Reply