473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Parse .cfm files

I have a bunch of files with the extension .cfm with PHP code in them.
It's a long story, but I need to keep the extension the same.
Is there a way to make PHP parse the .cfm file?
My web host says they can't do it on their end.
Should I argue?

Matthew

Oct 29 '06 #1
13 3771
Matthew256 wrote:
I have a bunch of files with the extension .cfm with PHP code in them.
It's a long story, but I need to keep the extension the same.
Is there a way to make PHP parse the .cfm file?
My web host says they can't do it on their end.
Should I argue?

Matthew
I can't say as I blame them. I wouldn't want to try adding non-standard
extensions like this for every client.

If this is Apache, they could with an AddType directive in the
httpd.conf file. You could do it in the .htaccess file.

But .cfm is a Cold Fusion template file. Why would you have php code in it?

You'll be much better off in the long run if you change the extension to
something standard like .php. Or just get yourself a virtual private
server where you can do anything you want.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 29 '06 #2
Matthew256 wrote:
I have a bunch of files with the extension .cfm with PHP code in them.
It's a long story, but I need to keep the extension the same.
Is there a way to make PHP parse the .cfm file?
PHP doesn't care about extensions.

fopen(), fread(), and fclose() come to mind.
If the .cfm is plain text I'd use file() instead.

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 29 '06 #3
Add the following line to the .htaccess file in the directory (If there
is one, if not create it)

AddType application/x-httpd-php .php .cfm #add any other extentions
you want to be parsed
Hope this helps,
--Joel
On Oct 29, 1:53 pm, "Matthew256" <PRESENT...@gmail.comwrote:
I have a bunch of files with the extension .cfm with PHP code in them.
It's a long story, but I need to keep the extension the same.
Is there a way to make PHP parse the .cfm file?
My web host says they can't do it on their end.
Should I argue?

Matthew
Oct 29 '06 #4
Jerry Stuckle wrote:
>
But .cfm is a Cold Fusion template file. Why would you have php code in it?

You'll be much better off in the long run if you change the extension to
something standard like .php. Or just get yourself a virtual private
server where you can do anything you want.
My guess is that the OP needs to preserve the URLs in existing links.
This is probably better handled through Apache rewrite than changing
the file extension of the source files.

Oct 30 '06 #5
Chung Leong wrote:
Jerry Stuckle wrote:
>>But .cfm is a Cold Fusion template file. Why would you have php code in it?

You'll be much better off in the long run if you change the extension to
something standard like .php. Or just get yourself a virtual private
server where you can do anything you want.


My guess is that the OP needs to preserve the URLs in existing links.
This is probably better handled through Apache rewrite than changing
the file extension of the source files.
A 301 redirect takes care of things quite nicely - and permanently.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 30 '06 #6

Jerry Stuckle wrote:
Chung Leong wrote:
Jerry Stuckle wrote:
>But .cfm is a Cold Fusion template file. Why would you have php code in it?

You'll be much better off in the long run if you change the extension to
something standard like .php. Or just get yourself a virtual private
server where you can do anything you want.

My guess is that the OP needs to preserve the URLs in existing links.
This is probably better handled through Apache rewrite than changing
the file extension of the source files.

A 301 redirect takes care of things quite nicely - and permanently.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
One would use rewrite to do that, naturally.

Oct 30 '06 #7
NC
Matthew256 wrote:
>
I have a bunch of files with the extension .cfm with PHP code in them.
It's a long story, but I need to keep the extension the same.
Is there a way to make PHP parse the .cfm file?
Yes. You can add an AddType directive to httpd.conf.
My web host says they can't do it on their end.
What they mean to say is that they don't WANT to do it. It requires
changing Apache configuration file, which is against policy in many
Web hosting companies.
Should I argue?
You can argue, but it is probably going to be futile.

Cheers,
NC

Oct 30 '06 #8
Chung Leong wrote:
Jerry Stuckle wrote:
>>Chung Leong wrote:
>>>Jerry Stuckle wrote:
But .cfm is a Cold Fusion template file. Why would you have php code in it?

You'll be much better off in the long run if you change the extension to
something standard like .php. Or just get yourself a virtual private
server where you can do anything you want.
My guess is that the OP needs to preserve the URLs in existing links.
This is probably better handled through Apache rewrite than changing
the file extension of the source files.

A 301 redirect takes care of things quite nicely - and permanently.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


One would use rewrite to do that, naturally.
You can use a rewrite. But a redirect will allow the search engines to
pick up the change without affecting current page rank. So eventually
you can get rid of your redirects.

If you just do a rewrite no one will know it's actually changed.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 30 '06 #9

Jerry Stuckle wrote:
Chung Leong wrote:
Jerry Stuckle wrote:
>Chung Leong wrote:

Jerry Stuckle wrote:
But .cfm is a Cold Fusion template file. Why would you have php code in it?

You'll be much better off in the long run if you change the extension to
something standard like .php. Or just get yourself a virtual private
server where you can do anything you want.
My guess is that the OP needs to preserve the URLs in existing links.
This is probably better handled through Apache rewrite than changing
the file extension of the source files.
A 301 redirect takes care of things quite nicely - and permanently.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

One would use rewrite to do that, naturally.

You can use a rewrite. But a redirect will allow the search engines to
pick up the change without affecting current page rank. So eventually
you can get rid of your redirects.
The easiest way to perform the redirection is with a rewrite rule, with
the R=301 flag.

See http://httpd.apache.org/docs/2.0/mod...ml#rewriterule

Oct 30 '06 #10
Chung Leong wrote:
Jerry Stuckle wrote:
>>Chung Leong wrote:
>>>Jerry Stuckle wrote:
Chung Leong wrote:
>Jerry Stuckle wrote:
>
>
>
>>But .cfm is a Cold Fusion template file. Why would you have php code in it?
>>
>>You'll be much better off in the long run if you change the extension to
>>something standard like .php. Or just get yourself a virtual private
>>server where you can do anything you want.
>
>
>My guess is that the OP needs to preserve the URLs in existing links.
>This is probably better handled through Apache rewrite than changing
>the file extension of the source files.
>

A 301 redirect takes care of things quite nicely - and permanently.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
One would use rewrite to do that, naturally.

You can use a rewrite. But a redirect will allow the search engines to
pick up the change without affecting current page rank. So eventually
you can get rid of your redirects.


The easiest way to perform the redirection is with a rewrite rule, with
the R=301 flag.

See http://httpd.apache.org/docs/2.0/mod...ml#rewriterule
True. You can use a rewrite to do a 301 redirect.

But not all rewrites are 301 redirects. A key point here.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 31 '06 #11
I've heard that Google looks at a 301 redirect as the same as a link
from the .cfm page to the .php page.
Is this correct?

Matthew

On Oct 30, 1:48 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Chung Leong wrote:
Jerry Stuckle wrote:
>Chung Leong wrote:
>>Jerry Stuckle wrote:
>>>But .cfm is a Cold Fusion template file. Why would you have php code in it?
>>>You'll be much better off in the long run if you change the extension to
something standard like .php. Or just get yourself a virtual private
server where you can do anything you want.
>>My guess is that the OP needs to preserve the URLs in existing links.
This is probably better handled through Apache rewrite than changing
the file extension of the source files.
>A 301 redirect takes care of things quite nicely - and permanently.
>--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
One would use rewrite to do that, naturally.You can use a rewrite. But a redirect will allow the search engines to
pick up the change without affecting current page rank. So eventually
you can get rid of your redirects.

If you just do a rewrite no one will know it's actually changed.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Oct 31 '06 #12
I've created the .htaccess file in my root directory.
However, this doesn't seem to work properly:
http://209.200.94.91/default.cfm

Matthew

On Oct 29, 7:14 pm, "Joel Parish" <joel.par...@gmail.comwrote:
Add the following line to the .htaccess file in the directory (If there
is one, if not create it)

AddType application/x-httpd-php .php .cfm #add any other extentions
you want to be parsed

Hope this helps,
--Joel
On Oct 29, 1:53 pm, "Matthew256" <PRESENT...@gmail.comwrote:
I have a bunch of files with the extension .cfm with PHP code in them.
It's a long story, but I need to keep the extension the same.
Is there a way to make PHP parse the .cfm file?
My web host says they can't do it on their end.
Should I argue?
Matthew
Oct 31 '06 #13
Matthew256 wrote:
I've heard that Google looks at a 301 redirect as the same as a link
from the .cfm page to the .php page.
Is this correct?

Matthew

On Oct 30, 1:48 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>Chung Leong wrote:
>>>Jerry Stuckle wrote:
>>>>Chung Leong wrote:
>>>>>Jerry Stuckle wrote:
>>>>>>But .cfm is a Cold Fusion template file. Why would you have php code in it?
>>>>>>You'll be much better off in the long run if you change the extension to
>>something standard like .php. Or just get yourself a virtual private
>>server where you can do anything you want.
>>>>>My guess is that the OP needs to preserve the URLs in existing links.
>This is probably better handled through Apache rewrite than changing
>the file extension of the source files.
>>>>A 301 redirect takes care of things quite nicely - and permanently.
>>>>--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
>>>One would use rewrite to do that, naturally.You can use a rewrite. But a redirect will allow the search engines to

pick up the change without affecting current page rank. So eventually
you can get rid of your redirects.

If you just do a rewrite no one will know it's actually changed.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

No. 301 is a permanent redirect. Google effectively replaces the page.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 31 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Els | last post by:
***newbie question*** Hi, I am trying to make my server (Apache) parse .html files as .php. I found this line of code: ForceType application/x-httpd-php placed it in an .htaccess file and...
22
by: Illya Havsiyevych | last post by:
Hello How easily parse VB/VBA code by VB/VBA code ? Is any ready solutions ? Thank's, illya
19
by: Johnny Google | last post by:
Here is an example of the type of data from a file I will have: Apple,4322,3435,4653,6543,4652 Banana,6934,5423,6753,6531 Carrot,3454,4534,3434,1111,9120,5453 Cheese,4411,5522,6622,6641 The...
21
by: William Stacey [MVP] | last post by:
Anyone know of some library that will parse files like following: options { directory "/etc"; allow-query { any; }; // This is the default recursion no; listen-on { 192.168.0.225;...
7
by: akira | last post by:
Hello, I need to parse this XML file or XML stream . Is it possible to parse it with DOM reading each DataContainer one by one. <DataContainer> <name> </name> <birthDate> </birthDate>...
14
by: Rob Meade | last post by:
Hi all, I'm working on a project where there are just under 1300 course files, these are HTML files - my problem is that I need to do more with the content of these pages - and the thought of...
5
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
1
by: Baron Samedi | last post by:
I have been searching, unsuccessfully, for a program which will parse header files and generate stubs for all external declarations (classes, functions, <shudderglobal variables). I want this so...
1
by: jo3c | last post by:
hi everybody im a newbie in python, i have a question how do u parse a bunch of text files in a directory? directory: /dir files: H20080101.txt ,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.