I've always used PHP, but recently I've been reading about why it's bad. I love Python, but I don't know how it works with the web. I've never even seen Ruby... what is worth learning? Should I stick to PHP?

+8  A: 

Like any software tool, it depends on the task.

+2  A: 

It depends on how rich the Framework libraries are. If there are rich libraries in the platform then your job will be very easy and interesting. But again everything depends on what you really want to achieve.

I feel that the latest .NET3.5 framework is one of the best. It supports AJAX and JQuery Try ASP.NET MVC. More over that when you learn C# or VB.NET you can apply that knowledge in many other places not only for Web side programming.

Jobi Joy
+3  A: 

the best is a matter of opinion. i like groovy and grails. ruby and rails is popular. there are lots of java based web frameworks. also, there is c#/.net.

Ray Tayek

Javascript ... can't go wrong with that ;-)

Update : I was joking, but only partly. Javascript is an incredibly important language for web development. More and more functionality is moving to the browser where it's almost always written in Javascript.

There already are options for server-side Javascript and I bet it's way more likely that at some point, this will become a popular option, than that client-side Ruby or PHP or Python or Perl becomes a standard.

That's not really an answer ..
hasen j
Agreed. Javascript is the glue for AJAX, and client side UI effects, but is hardly a web dev platform.
Jason Miesionczek
While I can understand some debate about whether this is a good answer or not, it clearly is an answer. There are server-side Javascript frameworks out there, and it is possible to write the bulk of an app in clientside Javascript (try ExtJS w/ Google Gears if you'd like to play).
I think of javascript like assembly code, necessary but I prefer to let other code generate it for me rather than write it directly
Brian Armstrong

Learning a new language won't hurt. PHP works fine, but IMHO, both Python and Ruby are much better alternatives.

Camilo Díaz
Don't see why they are better. If is good with php then he should stick with php and try and learn to use php frameworks like cake, zend or codeigniter! Or better yet, create his own framework. By doing that will really have a good understanding of the mvc patterns and other patterns aswell :)
PHP was designed such that you can put code in the template. While you can technically do MVC, I'd say it's discouraged by the language and by precedent.
Nikhil Chelliah
+7  A: 

Obviously, it depends on what you want to get done, what your team is working with, if you have other dependencies on other libs, etc

Look at Django. I've been around the block a few times with web frameworks and it's my favorite web solution bar none. It has in-built XSS protection, you don't have to worry about SQL injection anymore(mysql_real_escape_string or whatever can go to hell), the ORM is slick as hell and it's overall just a pleasure to work with. If you like Python, try it out. Look at pylons and too. See which one you like the best and use it.

+7  A: 

If you love python you should check out the django framework.

I think it's the best option for web development, but that's very subjective of course.

hasen j
made it a wiki because I no longer hold this opinion ...
hasen j
@hasen j: perhaps you could ammend your answer to reflect why you changed your mind?
Esteban Brenes
what a quick change of mind on such a subjective topic :))
Andreas Petersson
you tried django and change your mind?
quick? no it took me a couple of years. @Brenes: this is not the appropriate place to discuss this subject. in short, it's a framework, it helps you at first but then it gets in your way.
hasen j
+1  A: 

You can always start by writing Python CGI-scripts. You might want to look at the documentation for the CGI module. For more complex applications, you might want to think about using the Django framework for web applications, or some other Python web framework, like TurboGears or the lightweight

Ruby is a fantastic language, similar in many respects to Python. Ruby on Rails, another excellent web framework, is similar in concept to Django.

I would suggest starting with some simple CGI, so you can get a basic idea of what goes on under the hood, if you feel you need it. Then, learn one of the frameworks — most of the concepts are shared between them.

Any are better than PHP, unless you're only looking for a basic templating system, which I think is pretty much all PHP is really good at. ;)

Paul Fisher
PHP is good at being really fast.
Reducing an OOP language like PHP5 to a basic templating system is quite unfair, to say the least.
+89  A: 

Gmail is written in Java.

Wikipedia is written in PHP.

Many parts of are written in Python.

Slashdot is written in Perl.

Twitter is written in Ruby.

Stackoverflow is written in C#.

The list goes on...

As you can see, there is no best language, a language is only what you make of it.

is gmail really in java? isn't it in javascript?
Both actually, Java server-side and Javascript client-side.
Remember though that most of Google (all the bottom layer) is actually C++ ...There are times when C++ is the answer especially if you have good engineers and performance is at a premium
Robert Gould
Yes, the three top languages used at Google are C++, Java and Python. I didn't mention C++ because the question is about web development and in this context its usage is actually not very common. ;)
i love this answer, +1
Windows Vista is written in blood...
Mike Robinson
Amazon is written in Perl/Mason
Aaron F.
twitter also uses scalaebay is written in C (C++?)
Andreas Petersson
I agree - someone once asked me which is better for web development: C# ASP.NET MVC or PHP. Although I am a C# dev and love it, they're both as good as each other; you can do anything in either.
Are you saying anything but Ruby should work fine? :-)
The best language is the one that gets you to RTW.
Gmail is written with Google Web Toolkit, a Java library that can generate JavaScript.
Nick Retallack
Nick is right...Gmail is written in Java which is then compiled into Javascript, interesting distinction.
Brian Armstrong
Gmail uses Java, hosted in Google Servlet Engine:

I've been programming for awhile on the web and I'm not really going a "job" - I'm just a kid messin' around on the Internet looking for sites to code. I just thought I would clear up the fact that I'm not looking for what language to learn first or anything... I've been programming for awhile I just never saw a reason to switch from PHP until I started seriously reading about it.

As for .NET stuff, I try to stay away from that. I think I got my three choices down to Ruby, Python, or PHP. I was looking at Django earlier today and I might try that. But here's another question: is Ruby On Rails just Ruby for the web? Or can Ruby run on the web by itself? Is ROR just a framework to Ruby like Django is a framework to Python?


Logan Serman
Yes, RoR is just a Ruby framework much like Django. The difference is that RoR goes a lot further in monkey patching Ruby, sometimes to the point of changing the whole feel of the language.
Daniel Spiewak
just a side note here, stackoverflow is not meant to be a discussion forum, you're supposed to edit your question instead of posting a new answer
hasen j

"Best" is a very subjective qualification. Since you like Python, I would recommend Django (as have others on this question). Ruby is very nice, but I think Rails is too "sugary" for its own good. I use Ruby for a lot of bitsy server-side web scripting stuff.

I personally like Java for solid, large-application-ready web development. I have yet to see a framework which equals Wicket in terms of usability and architecture. Granted, Java is an annoyingly limited language, but you can always work around that by using other JVM languages like Scala and Clojure.

Daniel Spiewak

Assembly is the best! There is nothing like hand coding your CSS to be instruction perfect. However XML does get kind of messy if you are coding for an ARM processor ;)

Robert Gould

I do hand-code my CSS. :)

Logan Serman
Please don't reply to other anwswer, but add a comment instead. When answers get rated your answers won't make sense because of the up-down movement. This is not a forum. :)
@sork You can't add comment with his reputation... Vote up :-)
Luc M
@ Luc M huh? His rep is higher than mine, and I can comment.
@Eric Wilson My comment was posted November 27th. At this moment, his reputation was low... He sould delete this now.
Luc M
+2  A: 

Python and the .NET languages have an advantage over PHP and Ruby in that they have thorough in-built Unicode support. It's embarrassing seeing all the PHP webapps today that still fall over when you send them a non-ASCII character; a good language should be taking care of that for you.

(So does Java, but Java in itself can be rather cumbersome for web scripting and can need a bit of help from a scripting language like Groovy or Jython.)

+5  A: 

PHP being bad is subjective. Beware the almost infinite stream of language snobbery out there concerning PHP. Some of it is valid, some of it might be valid in certain rare circumstances, but most of it is just plain old snobbery*.

Weigh your pros and cons up carefully before swapping to an alternative would be my advice - if that's in favour of PHP, or equal, wouldn't you get more benefit from your time by learning something that you can use in conjunction with PHP? Javascript & jQuery, for example, which opens up a whole new world of webdev with Ajax.

*Just watch the downvotes come flooding in for pointing that out to those who practice it :)

+1  A: 

When you have ASP.NET, with many different languages that support .NET framework, and you see some huge web applications like Hotmail written with ASP.NET and its integration with Silverlight (which I think is going to become very popular) I don't see why one would choose any other tool.

Microsoft provides a giant and innovative collection of tools to work on the web, and its a good choice in my opinion.

If there is an area where .NET has not failed, that's the Web.

+1  A: 

PHP is my choice by far, adn I highly recommend it to you. Especially with the release of the solid OOP PHP5. I have a blast writing PHP5 and it is fast. The online support for PHP is ebyond great as well.

ASP.Net drove me nuts. It seemed to over complicate the whole web coding process and make me think within the box. In the ASP.Net class I took, it only seemed like we were learning why things wouldn't work rather than moving on...and web.config? why? I absolutely detested it. I like full control over the look of a site, and PHP caters to that like I needed. Also, to reduce PHP to system of templates is very unfair. It is quite capable of larger web sites and doing almost anything you want. I wrote a page in PHP on our admin site than went in a stripped all of the HTML out of a description column in our product database that the punk before me put in. I was thrilled how easy that was to actually code.
Also for a quick comparison, a simple mail function in ASP.Net (VB not C#, so not a super strong arg) was 25 lines of code, in PHP it was only 8. I have been told PHP's syntax and C#'s syntax are not very different from each other...

Ohio State's website is PHP. Facebook is in PHP. My company's totally dynamic Website is in PHP. The big software houses like to snub their nose at PHP just like Windows fanatics like to snub their nose at Linux. Our Slackware web server ran 2 years and 4 months without a reboot, the IIS server needs rebooted and worked on about once every month or two. Another argument for PHP.

From what I have been reading in job postings, PHP is on fire out west. Hopefully that continue to spread eastwards so I dont have to ever touch ASP.Net ever again.

Yes! Most of .Net, not just ASP is an absolute abortion. The tendency for over-complexity and "straitjacket" mentality is incomprehensible to me. While not perfect, PHP is definitely the easiest to pick up and run with. Go PHP.

HTML </sarcasm>

+2  A: 

There aren't really any bad choices for the web...

I really like django's use of models and the build in admin console for applications, although I haven't gotten used to pythons syntax and the required indenting :( I want to like it, but I just don't.

At work, we use Java and Cold Fusion-

I really haven't found anything I can't do with Java, but it's a bit too much for small projects.

Cold Fusion is really nice for rapid web development- I can have a site working in hours that might take days in Java. Plus, the newest Cold Fusion servers are really Java based, so the cold fusion pages are compiled to java class files just like jsp. And, you have the option of running pure java on the server.

+1  A: 

PHP is one of great language i found, i have been working in php since 2007, like it so much and its very flexible to do any thing we want. We can't find php like language, If you want to learn more advanced topics there are lot of things available in php to learn. I like to stick with php only.

+1  A: 

Almost all languages are worth learning, if only to give you another perspective on how things are done. Learning another language almost always makes you a better programmer. I use PHP a lot, but it's certainly not the right tool for everything. Although many times it a sufficient tool.

Both Facebook and Yahoo use PHP, but generally for their front-end not for their core. You could do a chat system in PHP (there are some out there), but it would fail miserably on the scale Facebook does. So Facebook went with Erlang, for some very good reasons.

Systems like ICE ( and Thrift (Facebook) exist so you can mix and match languages and use the right tool for the job. With todays systems, any one language is probably not the right one for every part of a system. The more languages you know, even if not well, the better decisions you will be able to make.

Python seems to be replacing Perl as the sys admin language. So if you have a need to do admin work, Python may be a good choice to learn next.

Brent Baisley

Here is my belated take on all this. If you are just getting going, make sure you have the client side down (CSS, Javascript, frameworks like jQuery, basic HTML, DOM mannipulation, AJAX, all that good stuff). Also learn how to use Photoshop or a similar program like GIMP or Fireworks to learn how to make cool looking user interfaces. Read up on web design best practices. Those skills will carry over regardless of what server side scripting language you choose.

If you are new to programming, and you just want to take data from a user and store data in a database, maybe check out PHP and MySQL. At least learn the basics. I myself have never used PHP or MySQL, but from what I've seen it if really easy to store data and retreive data using PHP and MySQL. There are tons of examples out there on how to use PHP, plus there are plenty of open source projects that have gained a lot of traction like Word Press, Joomla, Drupal, etc... Knowing a little PHP will help you use and modify those projects, which will be helpful.

Once you have arrived here, then there are numerous avenues you can pursue to take you to the next level. Here are a few ways you can go.

PHP with memcached and frameworks like CodeIgnitor or Zend. Again, don't have personal experience here, but if you want to take PHP to the next level this has been what is recommended to me. Learn about how to optimize queries and use memcached.

Or you can go the Microsoft route. The pros of doing this is that although there aren't as many open source Microsoft projects out there to build off of (there are a few, but not like PHP), but there is pretty much an answer to any problems that come up a few google searches away. ASP.Net using either VB.Net or C# can get you a decent paying job as well, especially if you invest a little time learning about Test Driven Development and you know SQL Server fairly well. This is what I did and over time it paid off for me very well. Doing web development using ASP.Net web forms is both a blessing and a curse...there is a high level of obstraction between what you write and the output, some people find that cumbersome...but you can use the new ASP.Net MVC pattern instead of ASP.Net webforms to get closer to HTML.

Or you can do the Ruby or Python route. To be honest, I think Ruby is pretty hyped right now, I know that a lot of people have flocked to Ruby on Rails only later to flock away...but I also know a few people who swear by it. Then there is Python, again no practicle experience, but I'd say if it is good enough for Google it is worth looking into.

Java is also out there, and people are doing interesting stuff with it. Still today a lot of interactive Flash media sites have Java servers on the backend.

And now there is also the new stuff. Flex/Flash, Unity 3D, Silverlight...these things might be the future of the web, and might be worth looking at in conjunction with you quest to take your basic PHP server side knowledge to the next level.

One thing I found interesting is look at what people are actually developing with. If you go to sites like, you can see that almost all the start up companies aren't using MS tech, some are using PHP (like Facebook), others it is hard to tell. But if you go to a bank's website or step into a lot of medium sized companies, you will see Microsoft products dominating corporate web sites and intranets.

I think the server side is kind of a wash really. Your main hold ups will be how fast your database can server out data. Generally compiled languages like ASP.Net will run faster then interpreted languages like PHP or Ruby on Rails, but not always, depend on how good of a designer built the site. I've seen small ASP.Net pages that took forever to load because the developer didn't understand when to and when not to use viewstate, and I've seen "slow" PHP pages load amazingly fast because they have been cached and optimized.

So the skinny is, learn the client side well, then learn the basics of SQL and Server Side data storage and retrievel probably with PHP and MySQL. Once you get the basics of that down, experiment around with some other server side languages, pick one you like, and learn it very well. Also keep at least a finger into what is happening on the "Rich Internet Application" side by learning Flash/Flex, Unity 3D, or Silverlight.

My 2 cents.

+4  A: 

The best language is a subjective question that depends on the type of app you are considering, the scalability, speed to market (how long it takes to code), and other variables.

I have used PHP, Python, and Java (j2ee in an ATG framework). Java is a techie dream - it is hard to setup, requires vast knowledge of the particular framework you are using, takes much time to code/compile/migrate/test, and breaks very easily with cryptic error messages. Very, very high learning curve. The end result - the same as any other framework - except one noticeable exception - AMAZING caching ability at the lowest object level you need - making is scale very, very well.

PHP is by far the easiest to set up (servers, db connection, [ see 'WAMP Server' ] etc), learn, and develop with (a Zend infrastructure is good, but beware of the MVC learning curve). The language is fairly intuitive, and the object model in V.5 resembles Java quite closely (sans the dot) It scales well, but caching must be done with a third party app or Apache.

Python is plain fun. I don't have the setup experience with python, so I cannot comment on the infrastructure needs. It is very, very fast, and has a plethora of libraries available for almost any need (including C++ libs - faster yet!). As a first web language, Python would be desirable. At a system admin level, as an alternative to the more cryptic shell scripting and PERL, it rocks!

Just my humble opinion,


'It is very, very fast' compared to what? For web apps? I love Python, mind.
Adriano Varoli Piazza

The whole language debate is meaningless. There are so many facts to consider when choosing a web language; simply asking people in a forum ensures you'll get every imaginable language in response. If it's ease of learning for the beginner, then Python is the clear choice. If it's strength of development and sheer power, PHP and ASP.NET is it. What matters most is what you like. Look at all the languages out there, play around with each one, then decided. The best language to use is a language that is easiest to learn while not sacrificing power and flexibility. I myself chose ASP.NET after playing around with a few different ones. Not only because I felt ASP could accomplish anything, but because it is a much more marketable skill in the job market than others, hands down. Learning that language thoroughly has allowed me to be a six-figure web programmer and still allowing me the time on the side to work on my projects. But reiterating the obvious here, play around with all of them. Until you are skilled enough to need very advanced things with your web applications, any of the languages can do anything.


what about JSP


I'm using PHP for several years. PHP has a huge community. So you can simply find lots of solution for nearly every problems. But it has some limitations for speacial expectations. For example, multi thread support and so much performance that python and java has. Also, PHP is a language for web development only. But you can develop native windows/linux/mac applications with python and java.

I'm planning to learn Python and use it some of my web projects. I don't like Java, because it needs a really big learning curve.

I never gave a change to .Net because of it's restriction of platform choosing(windows). I'm sure that I want to use a cross-platform language.

By the way, Ruby is a funny language that I want to try somethings on it...

Murat Corlu