I need to write a PHP code into a ColdFusion file. However, when I run the .cfm file I cannot see the PHP code inserted (i suppose because the file extension is not .php?). If I do otherwise, place ColdFusion code inside a .php file, I get the same thing backwards.

How do I write PHP code inside a .cfm file and get it to work? I guess this same question could go in general on how to write PHP code inside ASP, CGI and what-not.

    What you are trying to do may not be possible. In general, only one script engine will be called for any one file, usually based on the file extension. cfm files are parsed by Cold Fusion and then returned to the web server. The web server then usually assumes the scripting is finished and passes the result to the remote browser. Any embeded php just shows up in the browser unprocessed, correct?

    You might get around this in a very inefficient manner by telling the web server to process all files (*) as php. I do not know if this would result in another script processing pass or not.

    The real question is why are you trying to mix CFM and PHP? This souldn't be necessary, as both systems are pretty complete for web scripting.

      Write a Reply...