Sep 24, 2008

What the Web’s most popular sites are running on

Apache serves the most pages
With Linux hosting comes the common use of the Apache web server. It’s by far the most deployed web server on the Internet with a 58.7% market share (Netcraft), so it’s only natural that it would also be used by a majority of the sites in the survey.
However, even though it’s the behemoth in the web server market, Apache is slowly losing ground to competing platforms such as Microsoft’s IIS and up-and-comers like Lighttpd, at least according to data from companies such as Port 80 and Netcraft.
MySQL dominates the databases
With open source ruling the game it shouldn’t come as a surprise that the database of choice for all but one of the sites is MySQL, the ultra-popular Swedish open-source database.
“The features that you get for free on MySQL, with replication, in-memory and fault-tolerant databases (if using MySQL cluster), transaction support, and the wicked performance, cost thousands of dollars with other database engines,” says Joseph Kottke, director of network operations at FeedBurner.
These sentiments are echoed by the other participants in the survey as well.
“We needed something proven, flexible and low-cost,” says Simon Yeo, director of operations at Meebo. (His alternative title is “ops guy.” Other laid-back titles at Meebo include “marketing dude,” “server chick,” and “Mr. Sparkle.”)
These sites are far from alone in favoring MySQL. According to the MySQL website it’s the fastest-growing database in the industry, with more than 10 million active installations and 50,000 daily downloads.
PHP rules server-side scripting
Just like Apache is the most common web server software, PHP rakes in another “win” for open source when it comes to server-side scripting languages. PHP has been the most popular server-side scripting language for years and will probably remain so for some time, despite the hype around Ruby on Rails and other frameworks and scripting languages that are growing in popularity.
How the survey was made
The seven participants all responded to a set of 28 survey questions (all responses available in the PDF matrix) plus a number of follow-up questions about their website infrastructure where they could further explain their choices.
Pingdom Infrastructure Survey

A history of the dynamic web

Today we enjoy websites that are full of content and services that let us take care of anything imaginable online (well, almost). But the ride to our “Web 2.0” world of today has taken quite a while. It has been about 14 years since the first web page with dynamic content was created.
This is a look at the history of the dynamic web, especially the server-side programming languages and frameworks that make it all possible.

From static to dynamic

When the Web first started, there were only static HTML pages. The internet had been around for some time already, but it was only after the introduction of HTML (and with it, web browsers) that what we call the World-Wide Web got started.
A lot has happened since then. We would like to place the birth of the dynamic web to when CGI, Common Gateway Interface, was first introduced in 1993, 14 years ago. CGI was a way to let a website run scripts (usually Perl scripts back then) on the web server and display the output.
Now the web has evolved tremendously and is powered by server-side technologies and languages such as PHP, Java, ASP.NET, Python, Ruby (with Ruby on Rails), and many others.
(You may gasp in horror that we have not yet mentioned JavaScript and AJAX, but remember that the focus of this article is on the server side, not the client side.)
So, how did we get from A to B? For your viewing pleasure, we have created a handy little timeline.

The history of the dynamic web – A timeline

This is a time-line of key events in the history of server-side scripting languages and frameworks.
Timeline of server-side scripting history

The future of the dynamic web

These days websites are in many cases full-fledged browser-based applications. The line between web and desktop applications is blurring more for every day that passes.
There is a strong movement towards RIA (Rich Internet Applications) where some notable initiatives are JavaFX from Sun, Flex from Adobe and Silverlight from Microsoft. These frameworks allow for richer, more interactive and responsive web applications that can have more elements of regular desktop applications.
It seems very likely that the difference between what is a desktop application and what is a web application will eventually disappear.
A positive side effect of putting more power and flexibility on the client side, versus the way many web applications work today, is that it not only sidesteps limitations of HTML/CSS and JavaScript, but it will also make it easier for websites (web applications) to scale in the future since the load on the backend servers would lessen.
One thing we know for sure: Whatever the future of the web holds, it’s going to be an interesting ride.

Glossary (to fill in the blanks if you have any)

CGI (Common Gateway Interface)
A standard protocol for interfacing external application software with an information server, usually a web server.

Perl
Perl was a highly used language on the early web and still is very much alive today. Large websites using Perl include Amazon.com, LiveJournal.com, Ticketmaster.com and IMDb.com.

Python
A programming language that keeps gaining popularity. Some projects that use Python are the Zope application server, YouTube and Google has mentioned that they use Python extensively.

PHP
Most likely the most used server-side scripting language in the world. Over 19 million internet domains are currently hosted on servers with PHP installed. Examples of popular server-side PHP applications include phpBB, WordPress, and MediaWiki.

ColdFusion
Adobe’s ColdFusion framework still has a strong following. According to Adobe, ColdFusion is in use at 75 of the Fortune 100 companies.

ASP and ASP.NET
Microsoft’s framework for dynamic web pages. Examples of sites using ASP.NET are MySpace.com, Dell.com, Match.com and Monster.com. Common languages used with ASP.NET include Visual Basic and C#.

Lasso
Scripting language and framework loved by the Apple Mac community.

Java Servlet
Server-side Java. Sun’s Java language has a strong developer following. Some sites that use Java are eBay.com, LinkedIn.com and Hi5.com.

Ruby on Rails
A complete framework built around the Ruby scripting language. The philosophy of Ruby on Rails has been adopted to other languages with framework releases such as Django (Python), CakePHP (PHP), Symfony (PHP) and many more. Basecamp and Twitter are two websites running on Ruby on Rails.


Find the original article here.

Learning PHP: The What's and the Why's

Anyone who has designed web sites for any length of time knows the limitations of html and other client side languages like CSS and JavaScript. While these languages remain at the core of web development, their primary function is to control how text and graphics are presented. Because they lack the ability to manipulate information on demand, or communicate with web servers, the result is a static web page.
The ability to create dynamic pages opens doors. Suppose you wanted to create a survey to collect information from visitors to your web site. You could easily create a form with HTML that included all your questions, and have the results emailed to you. But to convert the raw information into a meaningful format, you'd have to manually compile it, and then organize it to gauge the results - a process which could take hours.
Fortunately for you, using scripting, there are easier ways to collect and evaluate the results of the survey, or any form. Rather than sending the information through email, a script grabs it and stores it in a database on the server. A second script communicates with the database, gathers and groups the information, and prints it out when you visit the page. The script could also produce bar graphs, percentages and totals, or present the information any other way you could conceive; automatically, and on demand.
So what language do you use when you want to analyze survey results? Or offer personalized information to your visitors, or display an archive of journal entries without managing copious HTML files?
In recent years, more and more developers have been turning to a relative new-comer to the scripting world for the answer: PHP.

What is PHP?

PHP, which stands for PHP Hypertext Preprocessor, is a server-side embedded scripting language. In non-technical terms: a PHP processor is run on the server (Windows, or a flavor of UNIX). When a page is requested that contains PHP, the processor translates and executes all the commands in the page, and then outputs the result to the browser as regular HTML. Because this translation occurs on the server, a page written with PHP is viewable with any browser, on any operation system.
Like most other scripting languages, PHP can be embedded directly into HTML. PHP code is separated from HTML by Start and End entities. When a document is parsed, the PHP processor only interprets the demarked areas, and outputs the results in the same position.
Ironically, PHP also includes the ability to almost completely separate code from HTML. For larger, collaborative projects this method is ideal because it allows designers to work on the layout of the page without interfering with the code aspects.

A Little History

PHP was introduced in 1994 as a loose collection of freeware scripts based on Perl and dubbed "Personal Home Page" Tools. The author, Rasmus Lerdorf, received surprising interest in the package from the professional and developer communities. By 1995, a mailing list had been established where other developers could provide feedback, bug-fixes and code ideas on the scripts.
Encouraged to expand the original package with additional features, Lerdorf released PHP-FI (or PHP2) in 1995. This version included the ability take the information submitted by forms on the web and convert it to usable variables. What was so important about this function was that it enabled user input to be captured and acted upon, allowing more complex and interactive web applications to be developed.
It was around this time that PHP changed from being a one-man project to one with a group of 7 core developers. Together, they refined the syntax of the language, added additional functions and methods, and the ability for other programmers to extend the capabilities of the language by plugging in modules.
With the release of version 3 in 1998, PHP had finally grown into its own. Like C and Perl, PHP is a structured programming language with variables, functions and classes. Its similarity to these languages encouraged experienced programmers to migrate to PHP and its ease of use rapidly won new users.
By version 3, PHP also included database support for a wide variety of platforms including mysql, mSQL, ODBC, Oracle and Sybase. It also was able to work with images, files, FTP, XML, and a host of other technologies.
The latest release of PHP is version 4. Rebuilt with a more powerful core processor, the new PHP engine (the Zend parsing engine) offers significant speed improvements over previous versions. PHP4 also includes sessions support (an easier way of working with cookies), and numerous smaller additions and improvements.
To date, PHP is still free and a frontrunner in the open source movement. However, unlike many open source projects, it's becoming more and more mainstream as an increasing number of businesses and organizations are making the switch to it.
For professional developers, one of the most exciting things has been the release of the Zend Encoder, which allows PHP source code to be encrypted. The Encoder carries a hefty price tag, but it holds the promise of more built in value for those selling custom scripts.

Why PHP?

It's no secret that there are alternatives to PHP: ASP, Cold Fusion, and Perl, to name just a few. While each of these languages has differences in syntax and structure, when it comes down to it, they can all produce the same results.
So, why would you choose PHP over other options?
- Simplicity. For people new to programming, this is frequently the strongest appeal. Even those with little or no programming experience can quickly get up to speed and begin creating full-fledged applications. Because it was specifically designed for creating web applications, PHP has a host of built-in functions to handle common needs.
- PHP is Open Source. Because PHP's source code is freely available, a community of developers is always working to improve, add to, and find bugs in the language. Open Source means you never need to rely on the manufacturer to release the next version if something doesn't work or pay for expensive upgrades.
- Stability, and compatibility. Currently, PHP runs stable on a range of operating systems including most flavors of UNIX, Windows and Macs and integrates well with most popular servers including IIS and apache.
PHP is also endowed with other goodies, like native support for many popular databases, an extensible architecture, and a processor that not only uses fewer resources on the server than many of its competitors, but also displays pages in record time.

Finally…

This article is the first in a series, covering everything from the basics of PHP to advanced topics and including information on related subjects such as databases and XML, as they apply to PHP.
Generally, PHP is a very easy language to learn. If you have worked with another structured programming language like C, or Perl, some of PHP will seem very familiar to you, and you'll find the language very easy to pick up. But keep in mind that previous experience in programming is not a pre-requisite for learning PHP or for understanding the concepts presented in this series. The only thing that is required is a desire to make the leap to server-side programming, and a thorough understanding of HTML.
About every week or so, we'll be taking a look at a new concept or theory of the language. The emphasis will be on providing the tools needed to start programming real, usable applications as quickly as possible. Cumulative, real-world examples will provide a taste of how to structure your own scripts, as well as present solutions to situations you will often encounter in your own work.
Whether you began reading because you needed to complete a specific project, or because you were just curious, by the end of this series you can expect to know what's involved in building dynamic data-drive sites. You will also have a virtual toolbox of code snippets and script design tricks you can pull out when needed.
Most importantly, you will have the knowledge to successfully develop your own projects from start to finish.

Find the original article here

Survey says: PHP passes Microsoft Active Server Pages

By JT Smith on June 11, 2002 (8:00:00 AM)

With a faltering economy forcing companies to cut spending whenever possible, less expensive and freely available Open Source software solutions may be gaining in popularity. Those wanting proof can look no further to PHP taking the top server-side scripting spot in a recent Internet host survey.
In April 2002, Netcraft's monthly Web server survey revealed that 24 percent, or around 9 million of the 37 million sites it surveyed, were using Hypertext Preprocessor (PHP) for a server side scripting language. For the first time, an Open Source scripting solution had passed Microsoft's proprietary Active Server Pages scripting to claim the top spot on the Netcraft survey.
For both the April and May Netcraft surveys, PHP and ASP were almost too close to call, with Microsoft's product offering coming in just a hair under 24 percent of all hosts running a server-side scripting language. With PHP having a fairly consistent growth rate of 6.5% per month since the summer of 2000, many Web professionals expect the gap to grow wider -- to Microsoft's detriment -- in the coming months.
"There was a resistance [to Open Source products] a couple years ago; that isn't the case now," says Tom Weirick, a Web designer based in San Jose, Calif. "In 2000 we had clients who wouldn't believe that something free could work as well, they would look at Microsoft charging a couple hundred or thousand for something doing the same thing and in their minds the Open Source stuff was inferior ... because it wasn't expensive."
"The message back then was 'spare no cost, just get us online' and now it's 'get us online, and save us money while you're at it.' So that's a chance for me to bring Open Source into the conversation and in the process give the client a good deal."
Jeremy Conn believes that the technical merits of Open Source software like PHP are far superior to any bottom-line appeal: "It wouldn't matter one bit if it didn't do the job it was designed to do," said Conn, who's worked on projects for companies including long-distance carrier AT&T, toothbrush maker Oral B, and Zap.com, a fisheries' failed attempt to become a Web portal.
Both Conn and Weirick said they present most new customers with a technology package called LAMP: Linux for an operating system, Apache for serving Web pages, MySQL for a database, and PHP for server-side scripting.
PHP, an Apache Software Foundation project, has been around since 1995, first taking form under the name Personal Home Page Forms Interpreter (PHP/FI) a series of public domain Perl scripts cobbled together to help its creator Rasmus Lerdof track hits to his online resume. Public feedback led to additional features being added, eventually resulting in the public release of a larger and more full-featured C implementation.
Around 1997, PHP/FI received a makeover including a new recursive moniker, Hypertext Preprocessor (PHP). One of the most significant additions made to this version of PHP was allowing programmers to write extension modules customizing PHP for their own needs.
The current major version of PHP is called PHP 4, with the first 4 version released in May 2000 (version 4.2.1 was announced last month). Considered by many to be the first version of PHP ready for enterprise deployment, PHP 4 features support for a wide variety of cross-platform Web servers, the ability to track user sessions, and a basic scripting driver, the Zend Engine.
PHP 4 can be found in use on a number of large-scale sites, including American broadcast network CBS, Japan wireless company NTT DoCoMo, and communications giant MCI Worldcom.
"That appearance of a level playing field has a huge appeal for companies," said Weirick. "The dry cleaner down the street or the kid in the family computing room has access to the same tools that multinationals have, and not only that, they can have a say in how future versions are developed. That makes a huge difference from Microsoft, who says it's their way or the highway."
"It's fun to bash Microsoft," adds Conn, "but the bottom line, I think, is that PHP is popular because it does what I need, what other people need it to do. As long as it stays fresh and relevant to what everyone is doing on the 'Net, then it will probably stay number one."

Find the original article here.

Sep 15, 2008

7 reasons I switched back to PHP after 2 years on Rails

SUMMARY: I spent two years trying to make Rails do something it wasn’t meant to do, then realized my old abandoned language (PHP, in my case) would do just fine if approached with my new Rails-gained wisdom.
INTRO / BACKGROUND:
Back in January 2005, I announced on the O’Reilly blog that I was going to completely scrap over 100,000 lines of messy PHP code in my existing CD Baby (cdbaby.com) website, and rewrite the entire thing in Rails, from scratch.
I hired one of the best Rails programmers in the world (Jeremy Kemper aka bitsweat), and we set off on this huge task with intensity. The first few months showed good progress, and Jeremy could not have been more amazing, twisting the deep inner guts of Rails to make it do things it was never intended to do.
But at every step, it seemed our needs clashed with Rails’ preferences. (Like trying to turn a train into a boat. It’s do-able with a lot of glue. But it’s damn hard. And certainly makes you ask why you’re really doing this.)
Two years (!) later, after various setbacks, we were less than halfway done.* (To be fair to Jeremy’s mad skillz: many setbacks were because of tech emergencies that pulled our attention to other internal projects that were not the rewrite itself.) The entire music distribution world had changed, and we were still working on the same goddamn rewrite. I said fuckit, and we abandoned the Rails rewrite. Jeremy took a job with 37 Signals, and that was that.
I didn’t abandon the rewrite IDEA, though. I just asked myself one important question:
“Is there anything Rails can do, that PHP CAN’T do?”
The answer is no.
I threw away 2 years of Rails code, and opened a new empty Subversion respository.
Then in a mere TWO MONTHS, by myself, not even telling anyone I was doing this, using nothing but vi, and no frameworks, I rewrote CD Baby from scratch in PHP. Done! Launched! And it works amazingly well.
It’s the most beautiful PHP I’ve ever written, all wonderfully MVC and DRY, and and I owe it all to Rails.
Inspired by Rails:
*- all logic is coming from the models, one per database table, like Martin Fowler’s Active Record pattern.
*- no requires or includes needed, thanks to __autoload.
*- real MVC separation: controllers have no HTML or business-logic, and only use REST-approved HTTP. (GET is only get. Any destructive actions require POST.)
*- all HTML coming from a cute and powerful templating system I whipped up in 80 lines, all multi-lingual and caching and everything
*- … and much more. In only 12,000 lines of code, including HTML templates. (Down from 90,000, before.)
Though I’m not saying other people should do what I’ve done, I thought I should share my reasons and lessons-learned, here:
SEVEN REASONS I SWITCHED BACK TO PHP AFTER 2 YEARS ON RAILS:
#1 - “IS THERE ANYTHING RAILS/RUBY CAN DO THAT PHP CAN’T DO? … (thinking)… NO.”

For 2 years, I thought Rails is genius, PHP is shit. Rails is powerful, PHP is crap.
I was nearly killing my company in the name of blindly insisting Rails was the answer to all questions, timeframes be damned.
But when I took a real emotionless non-prejudiced look at it, I realized the language didn’t matter that much.
Ruby is prettier. Rails has nice shortcuts. But no big shortcuts I can’t code-up myself in a day if needed.
Looked at from a real practical point of view, I could do anything in PHP, and there were many business reasons to do so.
#2 - OUR ENTIRE COMPANY’S STUFF WAS IN PHP: DON’T UNDERESTIMATE INTEGRATION
By the old plan (ditching all PHP and doing it all in Rails), there was going to be this One Big Day, where our entire Intranet, Storefront, Members’ Login Area, and dozens of cron shell scripts were ALL going to have to change. 85 employees re-trained. All customers and clients calling up furious that One Big Day, with questions about the new system.
Instead, I was able to slowly gut the ugly PHP and replace it with beautiful PHP. Launch in stages. No big re-training.
#3 - DON’T WANT WHAT I DON’T NEED
I admire the hell out of the Rails core gang that actually understand every line inside Rails itself. But I don’t. And I’m sure I will never use 90% of it.
With my little self-made system, every line is only what’s absolutely necessary. That makes me extremely happy and comfortable.
#4 - IT’S SMALL AND FAST
One little 2U LAMP server is serving up a ton of cdbaby.com traffic damn fast with hardly any load.
#5 - IT’S BUILT TO MY TASTES
I don’t need to adapt my ways to Rails. I tell PHP exactly what I want to do, the way I want to do it, and it doesn’t complain.
I was having to hack-up Rails with all kinds of plugins and mods to get it to be the multi-lingual integration to our existing 95-table database.
My new code was made just for me. The most efficient possible code to work with our exact needs.
#6 - I LOVE SQL
Speaking of tastes: tiny but important thing : I love SQL. I dream in queries. I think in tables.
I was always fighting against Rails and its migrations hiding my beloved SQL from me.
#7 - PROGRAMMING LANGUAGES ARE LIKE GIRLFRIENDS: THE NEW ONE IS BETTER BECAUSE *YOU* ARE BETTER
Rails was an amazing teacher. I loved it’s “do exactly as I say” paint-by-numbers framework that taught me some great guidelines.
I love Ruby for making me really understand OOP. God, Ruby is so beautiful. I love you, Ruby.
But the main reason that any programmer learning any new language thinks the new language is SO much better than the old one is because he’s a better programmer now! You look back at your old ugly PHP code, compared to your new beautiful Ruby code, and think, “God that PHP is ugly!” But don’t forget you wrote that PHP years ago and are unfairly discriminating against it now.

It’s not the language (entirely). It’s you, dude. You’re better now. Give yourself some credit.
Ok. All that being said, I’m looking forward to using Rails some day when I start a brand new project from scratch, with Rails in mind from the beginning.
But I hope that this reaches someone somewhere thinking, “God our old code is ugly. If we only threw it all away and did it all over in Rails, it’d be so much easier!”

Find the original article here.