Skip to main content
Participating Frequently
December 6, 2021
Answered

Incorrect opening of cfm-files

  • December 6, 2021
  • 2 replies
  • 1292 views

Probably a stupid question, but I can't open cfm files properly. For example, the text of the file: "

<cfinclude template="header.cfm">

<p>Welcome to my website on ColdFusion cfinclude usage!</p>

<cfinclude template="footer.cfm">

" outputs:

"

<cfinclude template="header.cfm">

<p>Welcome to my website on ColdFusion cfinclude usage!</p>

<cfinclude template="footer.cfm">

"

instead of

"

This is the header

Welcome to my website on ColdFusion cfinclude usage!

This is the footer

"

Tried to open in different browsers, ColdFusion installed. What could be the problem?

This topic has been closed for replies.
Correct answer BKBK

Unfortunately, it didn't help.


Assuming you used the default paths when installing ColdFusion 2021, then the location of the webroot would be:

C:\ColdFusion2021\cfusion\wwwroot

 

What happens when you place your test CFM files in that directory, then launch

http://127.0.0.1:8500/yourTestFile.cfm

 

 

2 replies

Known Participant
December 6, 2021

Silly question on my part, is the page you're attempting to output a cfm page, e.g. test.cfm?

Participating Frequently
December 6, 2021

Yes, of course.

BKBK
Community Expert
Community Expert
December 6, 2021

I agree with Dave's 2 diagnoses of connection to the web server and configuration files.

In any case, what is:

  • your Operating System?
  • your ColdFusion version, update level and Edition (Standard, Developer or Enterprise) ?

 

Is it possible for you to open the ColdFusion Administrator page?

Community Expert
December 6, 2021

My first question might sound pretty dumb, but are you putting all of this in a .cfm file? Or is it in something else? You can only use CFINCLUDE from within a .cfm file.

 

If that's not the problem, your .cfm file clearly isn't being processed by ColdFusion, just by your web server. In that case, you need to identify the connector configuration between the two. It might just be as simple as setting up the connector for that web site. The connector can work with multiple web sites, but you may actually have to tell it do do this, depending on how you initially set things up. If the connector configuration looks right but things still aren't working, you may have a problem with the underlying configuration files for the web server itself. Depending on whether you're using IIS or Apache, the process to fix this will be different but is usually pretty easy. Sometimes, it's not pretty easy though, especially if you have a lot of web sites under a single server. I've run into that problem myself, and sometimes I've been stumped! At that point, you might want to consult with Charlie Arehart or someone on his list, because they'll know all the details about how you can configure your web server.

 

Dave Watts, Eidolon LLC

Dave Watts, Eidolon LLC
Participating Frequently
December 6, 2021

Yes, the code is in a file with the .cfm extension. Can you tell me in more detail how I can determine the connection configuration? I am an amateur in this matter.

Community Expert
December 6, 2021

Well, there are a lot of things that might need to happen here. The first is, it's useful to identify your web server, because CF connects to IIS and Apache in different ways. IIS is much easier to work with ... when it works. Apache is a bit more difficult, but you learn right away how the connector stuff works. There's documentation for both of them in the Adobe online help, but that documentation only covers the simplest parts - when they each work. But that by itself might be enough to get you started.

 

Beyond that, there's a lot of text file configuration. There's actually a lot of text file configuration with Apache from day one if you have multiple virtual web servers, which is why it can be easier in the long run. With IIS, you run the connector configuration tool and it gives you options to (a) just connect ALL IIS virtual servers to your CF server, or (b) select individual IIS virtual servers and connect them to your CF server. Now, if that's all working correctly, IIS will receive the configuration tool's requests and write to its own internal configuration files. There's one for the entire machine (machine.config - I don't remember where that is), one for the IIS installation (applicationHost.config within %windir%\system32\inetsrv\config), and one for each web server within IIS (web.config within each web root directory). Now, to me, the real problem is that applicationHost.config can have settings for individual web servers, which I'd expect to be in web.config, but I don't know enough about IIS to answer that.

 

Anyway, within applicationHost.config usually, there are two things that bind .cfm requests to CF for processing. One is a general-purpose kind of thing, that will bind all sorts of requests for CF and then CF will kick back the ones it's not supposed to process. So you might have something like this:

 

http://yourserver/

 

... and if the web root has a .cfm file in it, AND that .cfm file is set up as an index file, IIS will just send the request for, say, index.cfm to CF automatically. The configuration tool is supposed to set both of these up for you, I think. The other binding is specifically for .cfm files:

 

http://yourserver/whatever.cfm

 

... and if that's in place, IIS should kick that over to CF for processing. So, you should try both of these sorts of URLs and see if one works and the other doesn't. That's basically the first step.

 

Dave Watts, Eidolon LLC

Dave Watts, Eidolon LLC