Page 1 of 1

combining asp and php?

Posted: Thu Oct 23, 2003 5:40 am
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

Posted: Thu Oct 23, 2003 7:22 am
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