phparchitect-2019-08

(Rick Simeone) #1
48 \ August 2019 \ http://www.phparch.com

finally{}


25 Years of PHP

Eli White


PHP was released in the fall of 1994, making this year the 25th anniversary of PHP! We’ve certainly
come a long way from the early days of the web. I’m not sure how many people reading this were
around back then, but I was. Things were not pretty back then.

It Began with CGI-BIN
Originally when you wanted to have any interactivity on
a website, you had to create a CGI-BIN program. This was
an application that lived in a different folder of your website
that would accept GET and POST variables for you. But back
in the beginning, it usually meant writing C code to handle
this. I’d post an example here of what it looked like, but even
a simple example would fill a page. You had to handle the
QUERY_STRING parsing, un-escaping data, and echoing
headers manually. Plus had no easy way to handle the data
coming in, since everything was a string from the browser,
and yet in C you need to declare your types strictly, convert
things explicitly, and hope that you didn’t overflow your buffer.
Did I mention that you had to compile your C? So every
small tweak you made to your code, you had to compile, and
wait to test it each time.

Then There was Perl


Around this time Perl started to become more popular as
a way to handle web forms. You still had to make CGI-BIN
scripts. But by using Perl, you had the benefits of a scripting
language for rapid iteration, and a system that was a bit more
flexible than C was.
There was a CGI library released for Perl in 1995 that made
coding much easier, since now you didn’t have to do all the
data parsing, escaping, an unescaping yourself. Now things
were a bit easier and code could look cleaner?

PHP to the rescue
While PHP was first released in 1994 quietly on Usenet and
it started just as an easy way to write C code, but then embed
it in HTML via special tags. The biggest pain back in the ’90s
was the need to embed HTML in your C or Perl scripts while
surrounding them with code as well. The groundbreaking
benefit of PHP was the ability to embed small scripts directly
in your HTML files themselves.
(Ironic now that best practices are to completely separate
your markup and your logic)
But at the time it was really powerful and meant that your
code could live alongside,or in, your HTML files, and didn’t
have to be relegated off to a separate directory.
It took a while for PHP to catch on. In 1998 it was running
just 1% of all websites. That number quickly spiked though,
as PHP 4 came out in 2000 and PHP 3 usage was already up

to 10% of websites at that time. Impressive growth in just a
few years.
Over time PHP matured into the amazing system that it is
today, running up to 83% of the web including some of the
biggest websites.

The Future
25 years is a long time, and PHP has gained enterprise
acceptance. We are not the new kid on the block anymore,
instead being the tried and true solution. We are still the
dominant force on the web, though much of that is powered
through the application and framework communities that
have formed around the PHP language, such as WordPress,
Drupal, Magento, Laravel, Symfony, and more.
It’s in those communities where I foresee the biggest move-
ment over the next 25 years. As PHP continues to mature as
a language, there will be less excitement about new features
in the language itself and more focus on the frameworks that
make it easy to ship solutions instead.

Eli White is a Conference Chair for
php[architect] and Vice President of One for
All Events, LLC. He hopes he has another 25
years of PHP in him, or at least a good 15 so
he can retire. @EliW

#!/usr/bin/perl
use strict;
use warnings;
use CGI qw(:standard);

print header;
print start_html('Simple Parameter Echo'),
h1('A simple form'),
start_form,
"What is your name? ", textfield('name'),
p,
"What is your favorite color?",
popup_menu('color', [' red', 'blue', 'green'],
p,
submit,
end_form;

if (param()) {
print hr,
"Hello ", param('name'),
" I see that you like ", param('color'),
hr;
}
Free download pdf