PHP vs. ColdFusion

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

PHP vs. ColdFusion

Post by waradmin »

I know theres already a topic on this, but its from 2 years ago, so ill start a new thread.

Im looking for peoples opinions on which language they prefer, as far as ease of use, reliability, speed, functionality, and learning level.

Ill give my 2 cents:

I am a PHP guy, have been for going on 2 years. I like PHP but recently (2 days ago) i took a look into ColdFusion. Once thought of as me to be a 'subpar' language that isnt powerful, i have already learned how great it actualy is.

Pros of Coldfusion:
- Easy to install and setup with an existing Apache/IIS server
- The code is much like HTML and PHP, but its easier to understand
- Way faster to code
- Much better looking. Tags such as <cfform type="flash"> make really nice looking flash forms, using ColdFusion code.
- Database use is much like PHP as far as SELECT and INSERT
- You add Access/MySQL/etc databases using ColdFusions Admin backend
- There isnt a need to disconnect from databases

Cons of Coldfusion:
- The jump from PHP to CF isnt a quick one
- ill update if i think of any more... :)

But what are others thoughts. I know this is a PHP forum, but ColdFusion is a great language worthy of peoples attention. Its not free, but the developers edition with server is free so download that and give Macromedia ColdFusion MX 7 a try.

Any other thoughts?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

i actually started with coldfusion as a server-side language so imo:

stick with PHP, CF has a very strange syntax and numerous well known bugs present within the language ?(at least when i last used it, these werent mere smal bugs either, huge bugs with authentication etc)

CF is dead imo, its not supported really at a scale to be worthy of your time and effort of learning (i wasted +18months of my life learning this language before i switched to PHP

so in my opinion
PHP > ColdFusion
alvinphp
Forum Contributor
Posts: 380
Joined: Wed Sep 21, 2005 11:47 am

Post by alvinphp »

Cold Fusion makes easy things easier and harder things impossible. Stick with PHP.
User avatar
Zoram
Forum Contributor
Posts: 166
Joined: Sun Aug 18, 2002 3:28 pm
Location: Utah
Contact:

Post by Zoram »

I've had to learn Coldfusion for my job that i started 4 or 5 months ago. Having a background in php it was pretty easy for me to pick it up. The problems i've found with it is that it doesn't allow you quite the flexability that php does as alvinphp said: makes easy things easier. But you lose a lot of control. I've missed the freedom i've had with php.

The reason they use Coldfusion is that they can train people on it faster and they have a turn over rate of a couple of years since its at a university. I still rather use php any day.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: PHP vs. ColdFusion

Post by onion2k »

- Easy to install and setup with an existing Apache/IIS server

PHP is easy to install too.

- The code is much like HTML and PHP, but its easier to understand

PHP is easy to understand.

- Way faster to code

Coding in any language is never the slow bit. Coding is quick. It's easy. The thing that takes time is researching and planning the logic of an application, and then testing the final code. There's a thing called the 40-20-40 rule in software development. It states that you should spend 40% of your time planning, 20% coding, and 40% testing.

- Much better looking. Tags such as <cfform type="flash"> make really nice looking flash forms, using ColdFusion code.

And how well do these forms meet accessibilty and usability guidelines?

- Database use is much like PHP as far as SELECT and INSERT

Databases are accessed using SQL (or QBE if you're mental). That's got nothing to do with the language you're using.

- You add Access/MySQL/etc databases using ColdFusions Admin backend

How well does CF's admin tool let you define database users? On a live production site you should have at least 3 seperate database users .. one that only has select privs for the general pages that just get data from the database, one that has insert and update privs on the tables that are modified through the front end (registration pages, checkout pages, etc), and one from back end admin pages. If CF doesn't enable you to configure that then it's inherently insecure.

- There isnt a need to disconnect from databases

That sounds like it's using persistant database connections. Very bad idea on a popular website, or if the developer doesn't keep a very close eye on the database buffer size. Persisting recordsets across pages is a quick way to use up all your server's RAM.

However, all those points aside, there's one simple overriding feature of PHP in it's favour. PHP is open source and completely free. CF is in the shaky position of being a product that's not hugely popular made by a company that's just been bought out by Adobe. What happens if Adobe decide to scrap it?
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post by waradmin »

PHP doesnt use persistant database connections, but your connections to the database are simply ended with a </cfquery> tag. Its easier to end the connection in CF.

The ColdFusion admin does make it easy to add users. Just click on advanced and type in the information accordingly.

As far as the SELECT and INSERT i was saying it uses standard SQL, so its the same as PHP.

The forms as far as im concerned meet guidelines. Take a look at http://myopenspace.net:85/cfcode/tracking.cfm (may take a few seconds to come up). Its all code, and looks great.

CF has a lower learning curve. Its just easier as far as understanding it goes. It comes with a great getting started guide that does a walkthrough of building dynamic pages, and the code is simple to understand (if you have a background in another language its even easier).

And PHP is easy to install yes, but often you need to edit files to get everything working. Coldfusion does that all for you.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

waradmin wrote:PHP doesnt use persistant database connections, but your connections to the database are simply ended with a </cfquery> tag. Its easier to end the connection in CF.
Ok, so in CF you explicity close the connection with </cfquery>. In PHP you can explicitly close a connection with mysql_close();. Or it gets closed at the end of the script.

One thing though.. if a database connection is closed with </cfquery>, wouldn't that imply that a script with two queries would have to connect to the database twice as the connection would close at the end of the first query? How would you use a connection twice in the same CF script?
The forms as far as im concerned meet guidelines. Take a look at http://myopenspace.net:85/cfcode/tracking.cfm (may take a few seconds to come up). Its all code, and looks great.
You might think that's ok, but anyone using a screenreader or alternative browser would be unable to use the page. If that was on a commercial website offering goods or services in the USA you could be sued under the Americans With Disabilities act. In the UK you'd run into difficulties under the Disability Discrimination Act. It looks nice, sure, but it's simply not good enough for any website I'd be part of.
User avatar
phpdevuk
Forum Contributor
Posts: 220
Joined: Mon Jul 04, 2005 5:31 am
Location: UK
Contact:

Post by phpdevuk »

I agree with the earlier comment about cf making hard problems impossible. I used it for a few years, and a lot of my current companies old websites are in it. If your working with macromedia products, or building a simple db site its very easy to use. More complex stuff is so much easier to do in PHP, you have to get creative with the format in CF to achieve the same results and wind up chasing your tell.

From my point of view the biggest CON to CF over PHP is that to run a CF server costs alot more than a PHP one as it isn't cheap.
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post by waradmin »

What really cought my attention with coldfusion is its intigration with my favorite coding/design environment Macromedia Dreamweaver. Database management, login creation and more is so simple because ColdFusion and Dreamweaver are both macromedia products.

Another thing i liked about ColdFusion is its NT-Login abilities. With PHP (from what I am aware) you need to have LDAP to connect to a Windows NT (2000/2k3) server if you want to do Active Directory based user accounts. With ColdFusion it only takes a few lines to authenticate users against a Active Directory system.

The report/chart generation abilities coldfusion have are impressive and simplistic. The flash graphs generated dynamicly based on Database content are a treat for the eye. Also the ability to with a few clicks make a PDF file out of database output results with graphs and a nice layout is simple, and great for business presentations if your presenting time spent on a project by user 1 user 2 and user 3 etc.

But I havent been using coldfusion for long, a few days now, so these are just quick observations ive made.

Note my server appers to be having problems. So i guess thats a con to CF, it isnt working at the moment on my server.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Re: PHP vs. ColdFusion

Post by JayBird »

waradmin wrote: Pros of Coldfusion:
- Easy to install and setup with an existing Apache/IIS server
- The code is much like HTML and PHP, but its easier to understand
- Way faster to code
- Much better looking. Tags such as <cfform type="flash"> make really nice looking flash forms, using ColdFusion code.
- Database use is much like PHP as far as SELECT and INSERT
- You add Access/MySQL/etc databases using ColdFusions Admin backend
- There isnt a need to disconnect from databases
Nearly all of the pros you gave for coldfusion were subjective
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

waradmin wrote:Another thing i liked about ColdFusion is its NT-Login abilities. With PHP (from what I am aware) you need to have LDAP to connect to a Windows NT (2000/2k3) server if you want to do Active Directory based user accounts. With ColdFusion it only takes a few lines to authenticate users against a Active Directory system.

The report/chart generation abilities coldfusion have are impressive and simplistic. The flash graphs generated dynamicly based on Database content are a treat for the eye. Also the ability to with a few clicks make a PDF file out of database output results with graphs and a nice layout is simple, and great for business presentations if your presenting time spent on a project by user 1 user 2 and user 3 etc.
These are only easy because Macromedia has taken the time to write the code for you. If you use some of the open source PHP libraries around you can have those things in PHP very easily too.

Take graphing as an example.. There's JPGraph, Sparklines, and others that are very easy to add to your code meaning you could be generating fancy graphs and charts in minutes. They're not included as part of PHP because they don't need to be.. In fact, having them as part of the language would actually increase the server overhead. That, in my opinion, is a disadvantage of CF. Things like graph generation should be treated as a seperate library to be included when necessary.

I realise you're new to CF and so you think all the new toys are wonderful, but PHPDN really isn't the place to evangelise about it. Take it to a CF forum.
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post by waradmin »

I completely agree with you, there is no reason to include those features in to PHP. And yes, the features are only avalible because they took the time to program them into Dreamweaver. But is that a bad thing? I mean sure its more demand on your server, but on the business side (where i come from) time isnt unlimited. People who code dont have time to learn complex functions and install plugins/edit config files to get a graph system working. Where i work, there isnt time to screw around, if something needs to get done, get it done quick, get it done right, and make it look good.

So i could go online, find the graph plugin, install it, restart my services, then look through their manual and read up on the functions, OR, i could go into my macromedia coldfusion manual under Graphs where it talks about <cfgraph> and quickly learn the few lines of self explanitory code to create the graph.

I prefer PHP, i know more of it, and, who am i kidding, it looks better than PHP. Someone walks by you and sees you coding PHP

Code: Select all

<?php if($row['required] == 1) {} else {} ?>
it does look more complicated and professional, and people think you know more than if they saw

Code: Select all

<cfif></cfif>
tag but it comes down to functionality in the work place. Companies want to pay people as little as possible to get as much as possible, and coldfusion can meet MOST companies needs quickly and make it look very nice. Business execs love flash forms, graphs, and grids, because it is attractive.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

I'm going to echo Onion2k's comments because I think they bear repeating:
Onion2k wrote:I realise you're new to CF and so you think all the new toys are wonderful, but PHPDN really isn't the place to evangelise about it. Take it to a CF forum.
In none of your responses have you really done anything beyond saying "Yes, but CF is great because..". Thats not what these forums are for.

However, in the interest of discussion, there are a few points you brought up that I think bear commenting on.
waradmin wrote:What really cought my attention with coldfusion is its intigration with my favorite coding/design environment Macromedia Dreamweaver.
You can get extremely solid integration as well using Zend's offerings. With a webserver (with php) and database running on your desktop, Zend is every bit as integrated. Give it a try and I suspect you'll see similar synergies.

I'm not endorsing Zend, because personally I find most of the integration features to be a negative point, not a positive point. To each their own, but if thats what you like, Zend will probably suit you well in a transition to PHP.
waradmin wrote:Database management, login creation and more is so simple because ColdFusion and Dreamweaver are both macromedia products.
Its important to note that it is not because they are both products by the same company. It is because Coldfusion has built-in functions for the majority of those items. PHP in contrast left those items up to individuals to implement, primarily to ensure more flexibility. By way of example, you'd have a very hard time integrating a phpbb forum login into your CF scripts, while it is fairly straightforward in php or even perl. The flexibility, as you mention, does mean a reduction in simplicity.

Integration doesn't have any impact on it, however.
waradmin wrote:Another thing i liked about ColdFusion is its NT-Login abilities. With PHP (from what I am aware) you need to have LDAP to connect to a Windows NT (2000/2k3) server if you want to do Active Directory based user accounts. With ColdFusion it only takes a few lines to authenticate users against a Active Directory system.
Thats completely inaccurate. On a windows server, in a AD environment, you can simply deny unauthenticated logins, and then:

Code: Select all

$loginstuff = explode("\",$_SERVER['AUTH_USER']);
//echo "Domain: " . $loginstuff[0];
//echo "Username: " . $loginstuff[1];
Its that simple, thanks to IIS. Now, I'm leaving out the larger discussion about the dangers of trusting the user that IIS states is authenticated, and the dangers of trusting the variable. Those issues are present in CF as well, so the response is completely appropriate.

With PHP, it only takes a few lines to authenticate users against an AD system as well.
waradmin wrote:The report/chart generation abilities coldfusion have are impressive and simplistic.
They are also inaccessible (flash with poor accessibility support - not the fault of flash itself!), and limited to a smaller subset than the awesome JPGraph.
waradmin wrote:Also the ability to with a few clicks make a PDF file out of database output results with graphs and a nice layout is simple, and great for business presentations if your presenting time spent on a project by user 1 user 2 and user 3 etc.
You can do the same with many of the pdf libraries in PHP.
waradmin wrote:People who code dont have time to learn complex functions and install plugins/edit config files to get a graph system working. Where i work, there isnt time to screw around, if something needs to get done, get it done quick, get it done right, and make it look good.
On the contrary, most enterprise development isn't about the quick one-off fix - its about maintainable code. PHP hits the sweet spot between quick development (its a scripting language, not compiled), and maintainable code. Thats why companies like Yahoo have embraced it extensively - it gives fast bang for the buck, but it also quickly ramps up to enterprise scale architectures with decent design. The same is not generally true for CF.
waradmin wrote:Companies want to pay people as little as possible to get as much as possible, and coldfusion can meet MOST companies needs quickly and make it look very nice. Business execs love flash forms, graphs, and grids, because it is attractive.
I disagree. Most executives in Enterprise development love accessibility, because it prevents lawsuits. I know its a smarmy answer, but its very true. In many industries in the US, developing code that the public will use has a direct financial impact if it is not accessible. The vast majority of CF 'features' you are referring to are also highly inaccessible.

But as I said above, PHP has libraries that give the same ease of use, and with more flexibility, more accessibility, and best of all - more maintainable structure.

You are leaving out a massive reason why CF isn't even in the same league with PHP: PHP runs on more platforms, and has a much larger installed base. Finding a PHP host is a cakewalk - the vast majority of webhosts offer it. You cannot say the same for CF. Worse, the integration features you love are also the reason why running CF means running Dreamweaver if you want to get the most power out of it. If you love Vi, or Emacs, you miss out.

I'm certainly not going to stoop to a flamefest on CF, but there are reasons for both PHP and CF to still exist. However, as Onion2k said, if all you want to do is tout the benefits of CF, this is the wrong place to do it.

We're happy to advise you on alternatives in PHP for the things you like in CF, but if your response to each is going to be "Yeah, but CF is great because..", the conversation should be held elsewhere.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

waradmin wrote:I mean sure its more demand on your server, but on the business side (where i come from) time isnt unlimited. People who code dont have time to learn complex functions and install plugins/edit config files to get a graph system working. Where i work, there isnt time to screw around, if something needs to get done, get it done quick, get it done right, and make it look good.
I'm not entirely sure who your point of "on the business side (where i come from) time isnt unlimited", but I'm going to assume it's me as you were responding to my post.

I'm Head of Production at the company I work for. My time is not unlimited. Quite the opposite.. I occasionally end up working 16 hours a day if my team has a nasty deadline. The fact is that I have a hell of a lot of experience in PHP development.. I've already spent the time learning complex functions and installing plugins to get things working. And people will pay for my experience. We don't screw around. And yet we manage to come up with great solutions to our clients problems without having to use CF.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I have a pretty solid background in each language and so I'm speaking from pure experience here:

I'm going to touch on the development time 'argument' (that it's much faster to develop in CF than PHP).

I think that argument might hold water in terms of the learning curve to learn CF vs learning PHP. CF is inherently easier to understand and therefore learn (if you have some basic HTML knowledge). The drawback to learning CF is that it doesn't conform to any 'programming standards', whereas PHP is much more like several other languages in existence. Therefore, if you have any kind of programming background, learning PHP should come much more naturally than learning CF. I'm not trying to paint the picture that CF is a language for newbs because I think it has its value for sure (even on an advanced level). But the reality of it is, it was designed more for people who do not have a programming background to facilitate the development of server side web applications. I think it provides a great starting block for people who want to learn some basic programming principles (ie creating loops, arrays, conditional statements, querying a database on the backend etc), the problem is, if someone wants to transition into a language that's much more 'standardized' in terms of syntax and programming structure, CF doesn't provide a solid understanding of the basics to really help move people forward.

so with all of that said: is it faster to develop in CF than PHP? In my experience...at first yes. For single page scripts using CF might have a slight advantage in that you can 'integrate' your server side stuff right on the fly with the simple tag interface. For larger scale projects, I ended up writing a bunch of custom tags that greatly increased my efficiency, but the time it took to write those tags was no less than it would take me to write a class library or a set of functions in PHP that do the same thing. At this point (now that I'm much more experienced in PHP), I'd say it's a wash really.

I gave up on CF with the release of MX so I haven't had an opportunity to see the java integration but I hear that it's pretty cool and provides for much more scalable applications that can be much more robust.
Locked