• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Incorrect opening of cfm-files

Community Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

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?

TOPICS
Getting started

Views

493

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 06, 2021 Dec 06, 2021

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

 

 

Votes

Translate

Translate
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Yes, of course.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Thanks for trying to help me.
Windows 10, ColdFusion version: 2021 release, no updates, Edition: Developer.
Yes, ColdFusion admin page opens without issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

The admin page probably won't tell you much, because it's probably opening via a standalone web server that's not part of IIS, if I remember right.

 

What happens if you just put this one line of code in a .cfm page?

 

<cfdump var="#CGI#" label="CGI variables">

 

Dave Watts, Eidolon LLC

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Unfortunately, it didn't help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

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

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Yes, when placing files in the root folder, the web page opened correctly. Does this mean that initially I should have run files from this folder? And thank you so much for your help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Yes, placing your project under the webroot is the default. This is quite convenient, especially when you're starting out, because it avoids complexity. 

 

The file C:\ColdFusion2021\cfusion\wwwroot\EmployeeProject\getEmployees.cfm will then have the URL http://127.0.0.1:8500/EmployeeProject/getEmployees.cfm

 

Once you get going, you could then find out how to configure ColdFusion to access files outside the wwwroot folder. In fact, you could then, if necessary, open a new discussion in the forum. 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Great, this information was not in my tutorials, sorry for wasting your time and thanks again)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

LATEST

My pleasure. You're wasting no one's time. We're a community and are here to discuss and help one another in anything related to ColdFusion. 🙂

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation