Start with the 'System
What Operating systems do you use to host your websites? Why do you use it? Might that change over the next five years? The starting point for choosing a programming language is to select the stacks you need to be able to support, and at the base of that stack is the operating systems you have to support.
Along with a lot of small to mid sized companies (and many larger enterprises), I've traditionally used Microsoft OS's for hosting. They used to be horrible, now they're really not bad at all. I knew that a lot of people whose opinions I respect wouldn't consider hosting on Windows (that has been getting a little better recently), but I'd been using Windows for a long time and I didn't have the time to re-learn Unix or the funding to get a sys-admin I could trust.
About a year ago I moved from a Windows laptop to a MacBook. One of the many drivers was to give me a reason and an opportunity to play with BSD when I had spare moments. I'm not a Unix guru, but I'm not quite as phobic of the command line as I used to be and I'm getting to the point where my pleasure at the ability to script the "lots of little programs" and easily edit the text config files outweighs my initial discomfort with the terminal window.
Microsoft is clearly a big force in SMB hosting. Their products are quite solid, but Windows is still not the ideal OS for hosting most sites. Our mail server (Windows running SmarterMail) recently got a virus - something that would have been much less likely (impossible?) with a well configured Unix mail server, and when we look at creating PCI compliant hosting solutions for storing credit card data, the cost of the Windows equivalent of OSS Unix programs like Tripwire means that we're going to have to use Linux boxes for our secure hosting. It also didn't hurt that almost all of the security consultants we spoke to felt that it was harder to create a truly secure Windows server than to do the same using something like Secure BSD. There are a number of really good reasons to choose Windows for hosting. You probably have Windows servers for other things, so being able to standardize on a single OS cuts support costs and things like ActiveDirectory integration can be useful for intranets, but the question you have to ask yourself is whether you might ever have to host some or all of your web apps on a Unix OS. If the answer is yes, you're probably going to want to choose a language that'll run on both Unix and Windows.
The Rise of the Virtual Machine
While many scripting languages have their own runtimes, I think we're going to see more and more standardization on languages that can run on a Virtual Machine (VM) - either a Java Virtual Machine (JVM) or the .NET Common Language Runtime (CLR). There are good use cases for not running a scripting language on either a JVM or the CLR, but I wouldn't seriously consider a web programming language where a solid effort was not underway to make it run on at least one of these virtual machines.
Your OS choice will affect your VM options. I actually rather like what Microsoft is doing with the CLR and (now) the Dynamic Language Runtime (DLR) on top of it for supporting scripting languages. However, Mono (and SSCI which is not for commercial use) aside, I am not convinced that the CLR will always be supported on both Windows and Unix. I could be wrong, but for me the only runtime that I can rely on in the long term to be available on both Unix and Windows is the JVM, so I'm willing to forgoe some of the nice optimizations and integrations that an all Microsoft stack would provide to run a JVM which hedges my OS risk by running quite nicely on Windows or Unix.
For the few people not thoroughly offended by my position on the religious war between operating systems and virtual machines, I figured I would also express an opinion on programming languages. It'll be interesting to see whether I get the most feedback for the pet languages omitted or for those that I mention but don't praise in sufficiently worshipful term . . . *sigh*
There are broadly two classes of languages you're going to want to look at for web development - scripting languages like PHP, ColdFusion, Python and Ruby and statically typed languages like C# or Java. People talk a great deal about languages like C# and Java being more "scalable". I posted a little earlier today about how that is not completely untrue - but can be very misleading. If you expect to need a large development team (how large is large? Probably somewhere between 5 and 25 developers or more working on the same application) or have to work with a lot of fairly average programmers, Java or C# will help you to scale the number of developers you can throw at the problem while still keeping the code base maintainable. If you have a smaller development team (certainly if it is less than 3-5 web programmers working on a given code base) you may find the overhead of developing in a statically typed language makes it a less efficient choice than a scripting language.
In general if time to market and flexibility (the ability to quickly change the way your application works) is the main driver you're going to want to do more development in a RAD scripting language whereas if you have some very fixed functionality that you want (perhaps some key APIs), you might consider using a statically typed language to implement those. Luckily with the growth of scripting languages on virtual machines it is now fairly straightforward to use a mixture of (say) ColdFusion and Java or IronPython and C# on the same project with the scripting language able to natively call the statically typed classes. There are of course plenty of use case dependent exceptions. There are classes of applications that can only realistically be written in scripting languages that support metaprogramming and there are some libraries and tools that are only available in Java or C#. In practice the type of developers you have will also affect this choice. If they can't live without IntelliJ or Resharper automated refactoring, you're gonna be using Java or C# whether you like it or not and if they are allergic to interfaces, static typing and closed classes you're probably more likely to be using a scripting language.
VB, C# and Java
Lets start with the "biggies" - the .NET languages (like VB.NET and C#) and Java. I'm not personally a fan of VB.NET. I have a VB background having programmed extensively in VB4 back in the day, so I have a sense of where VB.NET is coming from, but I find the syntax verbose and there are small but meaningful limitations in what can be done (CLR languages may supposedly be equal, but I think it is pretty clear that C# is and will continue to be first among equals). If you have a VB background, are a Microsoft shop and like the syntax it is a great way of creating applications on the CLR. If you're coming from a C or Java background, C# is the obvious choice. If you're new to programming, you're going to be better off in the long run learning C#, but if VB.NET floats your boat you may find it easier to work with (opinions vary) and it'll work for most things.
C# is amazing. I think it is more innovative and interesting than Java. If I had to single out one feature that fascinates me, it'd be LINQ, but for me the fact that I might not be able to run it on Unix machines means I'm going to have to stick with Java if I need any of the benefits that a statically typed language provides.
I've spent a lot of time looking at scripting languages. I've really focused on a fairly short list of PHP, ColdFusion, Python and Ruby as I've been using ColdFusion for a while and the other three languages are popular and/or interesting. I eliminated PHP fairly quickly for me personally. I find it to be similar to ColdFusion in terms of being a web RAD scripting language, but there are just so many things that are quicker in CF that I don't have a compelling reason to switch to what is in my opinion a weaker language. Python and Ruby are more interesting to me.
Two of the most interesting frameworks I've seen in a while are in Python (the third is in Squeak). It is generally more performant than Ruby at the moment and the syntax is very clean. Because of the semantic meaning of white space in Python it is a little more troublesome to generate (you have to be a little pickier about indentation and line breaks), but it is definitely a language on my short list that I'll probably use for projects over time.
Ruby is a very attractive language for someone into Domain Specific Languages and/or metaprogramming. I don't like Rails at all as I believe database introspection is the root of all evil (:->). I know that Ruby has performance issues and is a little Perly for some peoples tastes, but I love the metaprogramming constructs and syntactic sugar that Ruby provides for. It is a real hackers language and I know that I'll be doing something in Ruby before the summer is out. To me, more interesting than the (cool) language is the brain trust that has hooked up to the Ruby bandwagon. I fundamentally believe that the quality of hackers matters even more than the quality of the language they hack in, so for me starting to attend Ruby conferences and keeping up with Ruby blogs is a "must do". For most developers this probably wouldn't be as important, but because of the work I'm doing in code generation I really need to keep an eye on Java and C# (the languages that the big code gen projects are usually done in - excluding the embedded projects which are usually C++ but are less relevant to me) and Ruby (the language that the hackers who do the code gen play with when they get home in the evening - except for the Smalltalk guys :->).
All that said, I'm going to continue to use ColdFusion (the new version 8 which will be launching very shortly) as my primary scripting language. There are so many tags that allow me to implement functionality quickly (from the new AJAX tags and cfajaxproxy to the RSS, PDF, file and image tools) that it is worth the extra cost of the application server for the time it saves. I get why some people would choose Rails over (say) ColdFusion with Model-glue:Unity, but I've already built a CF framework that gives me better than Rails/Django level of productivity and the tags just allow me to prototype and deploy new classes of features so quickly that I can just start off with ColdFusion and then if necessary refactor to Java over time as my APIs settle down.
So, for my use case I'm leading with ColdFusion, looking at Java as my API stabilizes (I can fairly easily refactor my ColdFusion code to work with Java classes over time) and committing to play with Ruby (and maybe just a little Converge) to get a feel for developing and using in-language DSLs. Your milage will vary, but I hope that some of the ideas of the process we went through will help you to make sure you're using the right languages for your use cases.
And of course I didn't even mention many cool languages. For those who are interested, here is why I left out some of the cool kids . . .
I have looked at a number of other languages. Some are interesting but don't yet have enough commercial success for me to feel comfortable using them. that is a very personal choice. If I was a little more technical I might seriously consider Seaside. It is a very innovative web framework using continuations and is built in Squeak - a Smalltalk distro. I also know there are people building web applications in languages like Common Lisp, but I don't feel comfortable in my ability to write maintainable CL or to scale them. Doesn't mean it couldn't or shouldn't be done, but as a blub programmer I admit that anything more flexible that Ruby doesn't quite give me the structure I want to start from. Some people might also argue that library and device support is an issue, but I know it'd be a long argument with an indeterminate outcome, so I'll leave that to someone else to get into!
There are people who advocate functional programming languages (like Haskell and Erlang) but I've still not managed to convince myself that I can create the kind of web applications that I build with nothing more than monads to keep track of state. I am fully prepared to concede this may be more a matter of ignorance on my part than a fundamental weakness of functional programming languages (and I remember seeing a content management system that was almost entirely written using XSLTs which are purely functional transformations without state), but I don't have the time to rewire my brain that far for this revision. I still have a book to read this fall and maybe I'll be an Erlang groupie by Xmas :->
ML influenced languages like OCaml are cool, and I think D is very interesting (not least for it's support for design by contract programming), but they're a little too "edge" for my current tastes. I'll continue to read about them to get what I'm missing, but I'm not willing to bet my business on them just yet.