May 13th, 2013 The New York City MySQL Group - Creator of PHP

On Monday, May 13, 2013, OLC attended The New York City MySQL Group’s event, Creator of PHP: PHP & MySQLnd, What’s Cutting-Edge Now, What’ll Be in the Future. This event, held at TheLadders, featured Rasmus Lerdorf, the creator of PHP and the current Distinguished Engineer at Etsy.

Rasmus Lerdorf, back in 1995, kickstarted the PHP project and has contributed to a multitude of projects since then. Lerdorf invented the LIMIT clause, which has been incorporated into MySQL and other databases. Lerford was at Yahoo! for more than seven years as an infrastructure engineer, joining Etsy as a Distinguished Engineer in 2012.

Lerdorf started programming in 1993. “It was before Perl or Perl wasn’t what I wasn’t looking for. I wanted HTML to look like HTML and we needed something dynamic to teach people to create webpages—no one knew how to do that in 1994,” he said. Lerdorf created PHP v.1 with the goal of providing a framework to create complex languages. “It would do all the heavy lifting to expose the backend to front-end developing.”

“These tech writers were lost. This is where PHP built itself. People had little time to build dynamic websites—PHP was the first solution. LAMP wasn’t an accident. The web was a toy back then. It wasn’t interesting to computer science people. We ended up focusing on the robustness of PHP, then performance, then on security. We found out that

ISPs loved sharing hosting, so we created a technology to take into account the maximum request and limited user access on servers,” Lerdorf said.

“Scaling up is expected—and we scaled fast. We were growing too fast to worry about security. Apache was born through patching servers—I helped start it and realized that we needed an API to extend it and let people publish modules for it. PHP was one of the modules that let people publish things,” Lerdorf said. He also claimed that code is never perfect. “It never is,” he said. Lerdorf talked about site faulting as a robustness based on how one architects things.

“I didn’t want to maintain state whatsoever—so PHP doesn’t have any problem scaling.

It scales infinitely. Look at Facebook or Yahoo—they just add servers. It’s the perfect sandbox. It was designed so that you had control of the session. Scaling up is easy, but scaling down isn’t. Very few environments address this. You need lots of examples and documentation. Also thinking about how to make this simple is critical,” Lerdorf suggested.

He went on to name some features in PHP that people had questioned over the years.

• Case insensitive function names: “PHP slid in and looked like HTML. I wanted it to function in both. I never had a really good reason to change it, but I should’ve done it back when only 3,000 websites were using it compared to 2.5 million today,” Lerdorf said.

• Naming inconsistencies: “This is because of API irregularities,” he said.

• $ signs: “Dollar signs are indicators of variables,” he said.

• Globals: “It’s nice to see that you’re touching that variable and that it’s not going to have an effect on the code,” Lerdorf said.

• Magic_quotes: “I was just being lazy—I soon realized that this became a bad idea in later versions,” he admitted.

Lerdorf talked about the latest version of PHP—version 5.4. It currently boasts a broad range of performance improvements including: Fast CGI request handling, better memory handling, startup/shutdown, built in webserver, short array syntax, traits (AKA Horizontal Code Reuse), among others.

He also went to list a variety of changes that might trip the user up: Default character set is UTF-8, array to string conversion, register_global has been completely removed, as well as magic quotes, variable break/continue was removed too, and more.

MySQLnd was next on the agenda and Lerdorf briefly talked about this native driver.

“It was specifically written for PHP and uses the PHP memory manager. MySQLln is a PHP-specific MySQL client library. It uses much less copying data around, better L1/L2 cache usage, and it has tight integration with PHP. MySQLnd also has plugins that lets users do things that MySQL doesn’t. MySQLnd currently supports plugins like replication and load balances, query cache, user handler, memcache and multiplexer.

MySQLnd’s unique features are that it allows for asynchronous queries, improved persistent connections, performance statistic calls, Plugin API, mySQL_Fetch and many more.