PHP Scripting Language










PDF version of this report
You must have Adobe Acrobat reader to view, save, or print PDF files. The reader
is available for free
download
.

PHP Scripting Language

by Lynn Greiner

Docid: 00011529

Publication Date: 1805

Report Type: TUTORIAL

Preview

PHP is the most popular and simple of all dynamic languages, powering
millions of e-catalogs, portals, and Web sites. The language has made inroads into
enterprise Web design and development initiatives everywhere. While PHP simplifies and energizes certain
types of Web initiatives, it remains inappropriate for others. This report explains the areas in which PHP can be of
most benefit while warning enterprises away from projects that are not appropriate for PHP.

Report Contents:

Executive Summary

[return to top of this report]

PHP, or Hypertext Preprocessor, is a dynamic Web development language that has
contributed to the look and feel of millions of Web sites all over the
world but has not yet proven itself at the highest enterprise levels.

Related
Faulkner Reports

LAMP and WAMP Basics Tutorial

Linux-Based Application Development Tutorial

Available as a free, or Open Source, tool, PHP ranks among the most popular programming languages today
and for several years was the undisputed leader in the Web programming market.1

The development of PHP is driven by the PHP Group, a community of developers that contribute to the various
components of the language. The PHP Group is also the official licensor of
PHP.2

PHP may be downloaded from the Internet from www.php.net
or www.zend.com.

PHP is primarily employed for server-side scripting, in which
all PHP code is run on the server before any related data is passed to the
user’s browser; i.e., no PHP code ever reaches the user. In addition to
its server-side applications, PHP can be used for command line scripting
in which a PHP parser enables the execution of a script without any server or
browser support. PHP can also be invoked to develop simple desktop
programs.3

PHP is compatible with all major operating systems, including:

  • Linux
  • A number of Unix variants such as HP-UX, Solaris, and OpenBSD
  • Microsoft Windows
  • Mac OS X4

PHP also supports most common web servers and cloud
platforms including, among others:

  • Apache
  • Microsoft Internet Information Server
  • Oracle iPlanet (formerly known as Sun ONE Web Server, or Sun Java System
    Web Server)5
  • Microsoft Azure
  • Amazon EC2

The latest major release of PHP, 7.2.0, was released on November 30, 2017. The
current version is 7.2.5, released April 26, 2018. Version 7.0.30, a security release, also came out on April 26, 2018,
as did Version 5.6’s current iteration, 5.6.36,
containing numerous bug fixes.
Version 5.5.0, came out in June 2013 and
dropped support for Windows XP and Server 2003.
Version 5.5 support ceased in July 2016.
Version 5.4.0, was released on March 1, 2012, with
new features including traits, shortened array syntax, multibyte language
support, and a built-in Web server in CLI mode. It was the last version supporting Windows XP and Windows Server 2003.
Version 5.4.39, released on March 19, 2015, fixed numerous bugs;
support version 5.4 ceased in Septenber 2015. Version 5.3 was released in June 2009 and contained many new features
including namespaces, closures, and late static bindings as well as
over 140 bug fixes; its latest version is 5.3.29, released in August 2014. The last in the 5.2 version, 5.2.17 came out on
January 6, 2011, and contained a fix to a critical issue
found in the December 2010 release (which was supposed to have marked the end of
support for 5.2).

Version 7.1, released on December 1, 2016, contained numerous
changes, including the deprecation of the mcrypt library, whose development was
abandoned in 2007, and which contains multiple bugs and unmerged patches.

The full list of modifications can be
found in the RFC.

Description

[return to top of this report]

PHP, or Hypertext Preprocessor, is
the computer scripting language created by programmer Rasmus Lerdorf in 1994 in
order to facilitate the development of dynamic Web applications. Lerdorf drew
upon the syntax of the venerable C computer language to create PHP, a highly
scalable, simple, and robust language exquisitely suited to building interactive
Web applications by communicating with back-end databases and serving dynamic
content to the user. PHP departed from other languages such as C in that it did
not require a compiler, and eschewed lower-level machine programming. Instead, PHP code was interpreted at runtime and devoted itself to the
higher-level functions of Web infrastructure.

From its beginning, PHP was an Open
Source endeavor, meaning not only that it was free but also that it invited
further development from thousands of programmers worldwide. PHP, steadily
refined since 1994 and subjected to a comprehensive overhaul in 1997, has played
an inordinately powerful role in enabling the rise of complex Web sites,
e-commerce, and e-catalogs. PHP was one of the first and most important
steps away from the static, HTML-driven paradigm that once defined the Internet,
and has revolutionized the way consumers and
businesses interact with the Web. As a language, PHP has grown
ungoverned, as there is no single team of programmers in charge of its
development. PHP’s anarchic growth, while resulting in some serendipitously
user-friendly features, also limits the language’s application to certain kinds
of Web sites.

PHP Usage

PHP pages contain HTML with embedded PHP code. The PHP code is enclosed in special
start (<?php) and end (?>) processing instructions, permitting the
programmer to jump into and out of PHP mode, as illustrated in Table 1. (Note: echo is a PHP language construct meaning "output one or more
strings.")6

Table 1. PHP Code Sample
PHP Code Sample

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

     "http://www.w3.org/TR/html4/loose.dtd">

<html>

     <head>

         

<title>Example</title>

     </head>

     <body>          


    


<?php


              


echo "Hi, I'm a PHP script!";


         

?>

    

</body>

</html>

Source: PHP Group

Current
View

[return to top of this report]

According to
usage statistics gathered by Netcraft, as of January
2013 about 244 million sites featured the use of PHP. PHP is more
prevalent than its dynamic language cousins, Perl and Python. By now hundreds of
thousands of programmers of many different varieties, from hobbyists to
high-powered coders, have trained themselves in PHP and have accumulated
extensive experience in the language. PHP is therefore both mature and popular. The TIOBE Programming Community Index, which ranks languages
according to their popularity, places it at number 7 in its May 2018
ratings, up from number 9 a year ago.

PHP has entered the enterprise from many different angles: Many commercial Web sites, intranets, and extranets utilize PHP. However, PHP
has achieved less penetration into the largest commercial Web sites. This is for
at least two allied reasons that have to do with the character and evolution of
PHP:

  • The innate combination of business logic and presentation
    in PHP means that code containing instruction on what a Web page does (e.g.
    pull up a customer’s requested product) mingles with code containing
    directions about how the Web site should look. This creates a layer of
    complexity that requires programmers to be exceptionally diligent in keeping
    these two components separate.
  • PHP is simple – maybe too simple. This is a result of the
    language’s original intention, which was to work on personal Web pages, and
    can be remarkably helpful when working on a project limited in scope. However, when building large and complex Web sites, PHP’s simplicity can
    serve to confuse many programmers who may be unable to use PHP to specify
    certain actions. More complex languages (such as C++, Perl, and Python)
    might be better suited to more complex projects.

Therefore, not many enterprises have made enduring bets on PHP
to power their largest Web projects, although they have been conscientious in
hiring developers and other technical employees proficient in PHP. However, many
sites use tools that are powered by PHP, such as Drupal, WordPress and Joomla!,
so PHP development expertise is still a plus. According to W3Techs.com, PHP is
primarily used in lower traffic sites, although it does note that Facebook.com,
WordPress.com and Wikipedia.org are also users.

As an Open Source language, PHP is often exploited as part of
the so-called LAMP (Linux, Apache, MySQL, PHP) stack of free Web infrastructure
components. Currently, each of these components is well supported by large and
active ecosystems of developers and value-added resellers who provide
professional services and support. It is extremely unlikely that either PHP or
LAMP will ever become paid technologies. Rather, their Open Source nature
guarantees that they are, and will remain, free, although the emergence of
companies providing paid support for these free products are inevitable.

In 2006, Microsoft surprised the community by funding
a partnership with Zend (now part of Rogue Wave Software) to ensure PHP would work well on Windows
servers. Since then, a small but dedicated open source group within
the company has been developing modules to let PHP function at its
best under Windows. In August 2009, the company released a PHP toolkit
for ADO .NET Data Services which enables multiple data sources to be
exploited in a REST-style interface. PHP on Windows lets PHP
applications run on IIS. Microsoft’s now discontinued Expression Web authoring software
can open and edit PHP pages; it even shipped with a PHP development
server for testing those apps. Microsoft has rolled its functionality into
Visual Studio and offers a PHP for Visual Studio extension to round out the
offering. The Microsoft-sponsored CoApp project
(Common Opensource Application Publishing Platform)
was developing a community-driven package management system and toolset for open source
applications on the Windows platform, however it is all but dead.

Outlook

[return to top of this report]

PHP growth peaked in late 2005 at about 23 million domains, fell back, and
then found new momentum and grown to well over 25 million. This may correspond to
the entire Web’s rate of growth. According to W3Techs.com, 83.4 percent of Web
sites now use PHP, up less than one percent from last year. It named PHP the Server Side Programming Language of the Year for 2017.
The language’s high penetration
is likely driven by the content management systems powered by
it. Whatever the case, PHP will probably
continue to be an essential Web development technology for at least another
generation, as our current Web infrastructure paradigm demands both a database
and a language (such as, but not limited to, PHP) to invoke and interact with
that database in order to create unique experiences for end users.

The
interactive, personalized Web had already acquired a lot of momentum in the
mid-1990s. The explosion of e-commerce, the popularization of such Web sites as
Amazon.com, and the geometric increase in content available on the Web
demolished the old static HTML in which, for example, a catalog was just a list
of products on a page. In the early part of the 2000s, the advent of Web 2.0
rendered the static paradigm even more quaint. Today, users of all kinds and
inclinations demand fully interactive Web experiences in which they are free to
find and parse the information they want rather than having static blocks of
information forced upon them. This ethos of choice and personalization will not
go away, and it is clear that PHP will not be its main or only enabler;
technologies such as Ajax and HTML5 have also carved out their own niches.

Nonetheless, PHP remains a popular and prevalent Web development technology. PHP
might not be at the heart of a large enterprise project, but may have many
contributions to make to smaller and allied projects. PHP is simple and
versatile, and an increasing number of companies is putting it to use in
smaller-scale and content-oriented Web development projects. For example, PHP is
perfectly appropriate for small product catalogs, members-only Web sites, and
content portals. And Microsoft’s involvement ensures it is well
supported on Windows platforms as well as the more usual LAMP
infrastructure.

Said Drupal creator and project lead Dries Buytaert, "More than ever, the future of PHP depends on popular PHP
applications that have emerged over recent years. Conversely, the future of Drupal depends on PHP. Moreover, many of us are staking our future, and that
of our businesses, on Drupal and, by extension, on PHP. The same is true for
those who make their living with Joomla!, WordPress, phpBB, vBulletin,
Typo3, and ezPublish."7

Recommendations

[return to top of this report]

Enterprise Web development, broadly considered as
the sum of commercial Web site, intranet, and extranet development, should take advantage of the latest release of PHP in order to create meaningful
interactions between front-end users and back-end databases in particular
situations, and avoid PHP in other cases. Here is a quick action guide:

  • Before initiating or upgrading a top-level Web project (such as the
    design of a large commercial Web site) with PHP, investigate what your
    best-in-class industry peers have done. If you’re not seeing a lot of PHP in
    the Web development schemes of your industry’s top performers, the chances
    are that high risk is involved. In such a case, be a fast follower: Don’t be
    the first to use PHP, but do be the second to use Perl, C++, or Python.
  • Determine how much content the Web project will showcase. If the product
    catalog is limited, for example, PHP would be a fast,
    appropriate, and free way of staging that catalog online. If the project
    must deal
    with tens of thousands of distinct pages with complex attributes, PHP will
    probably not be the right choice.
  • Remember to govern PHP projects in such a way as to keep the business
    logic and presentation layer separate.
  • Look for PHP skills among both in-house programmers and contracted
    developers. Even if PHP will not be used in a big enterprise project, the
    chances are high that it can come in very handy in more limited and ad hoc
    projects. Good PHP skills can be put to use in many contexts.
  • When looking for PHP skills, know what to prioritize. The best PHP
    coders ought to be able to handle a mix of both front- and back-end
    technologies, including but not limited to Cascading Style Sheets (CSS),
    Javascript, machine-to-machine networking, and Object-Oriented Programming. Managers in charge of hiring coders
    ought to become intimately familiar with the difference between genuine and
    rudimentary PHP skills, especially in a marketplace overcrowded with PHP
    coders.
  • Engage 24/7 professional support for PHP-driven Web sites in order to
    supplement the services provided by on-site IT staff. Since some users have
    reported scalability problems and other issues with PHP deployed in large
    Web sites, pay extra attention to the question of support.
  • Check to see whether the latest version of PHP and other elements of
    LAMP are supported by the chosen hosting provider, if in fact the
    provider’s hosted authoring and Web development infrastructure tools are
    being used. Given today’s volatile security landscape,
    maintaining support for the most up-to-date versions is critical to protect
    sites from cyber attacks.

References

[return to top of this report]

[return to top of this report]

About the Author

[return to top of this report]

Lynn Greiner is Vice President, Technical Services, for a
division of a multi-national corporation, and also an award-winning
computer industry journalist. She is a member of Faulkner’s Advisory
Panel.

[return to top of this report]