Forum Moderators: coopster

Message Too Old, No Replies

using PHP with other langauges

         

bumpkin

2:17 am on Sep 20, 2010 (gmt 0)

10+ Year Member



In cases where it's difficult or awkward to use the .php extension for the script name, is there another way to enable php code in a script?
I want to give clients a simple php function to insert in other programs.

Anyango

4:28 am on Sep 20, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



like in a .html or .html file ?
You just have to tell the webserver to interpret those files as PHP and then put your php code in there as you would normaly put in a .php file

like for apache if you wanted to tell apache to read .html files in a directory as PHP files and process the code in them, you can use this line in .htaccess

AddType application/x-httpd-php .html

It can also be done invidividualy for single files using <Files> for Apache

bumpkin

6:42 am on Sep 20, 2010 (gmt 0)

10+ Year Member



Yes, but I was really thinking of c-sharp and other languages, which have their own extension. There's no problem mixing php and other languages is there?

Anyango

10:54 am on Sep 30, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is, server needs to be setup to be able to parse and send the language codes to their interpretors accordingly. Its not easy to set up