What is PHP?
Unless you have a static HTML site, you’ll need to use scripts and applications to serve up your website content.
PHP stands for PHP Hypertext Processor, and it’s designed to make dynamic websites easier to create. It’s primarily available on Linux web hosting plans.
PHP’s official homepage. Screenshot via WhoIsHostingThis.
How Do You Know If You Need PHP Hosting?
You want a web hosting provider that supports PHP if:
- Your blog or business website relies on a content management system (CMS), like WordPress, or
- If you need to protect your site’s code and customer information behind a robust line of defense.
PHP’s open-source code and versatility make it a popular web hosting offering for most providers.
An example of PHP coding. Image courtesy of Pixabay and licensed under CC0.
Where Do I Install PHP?
Most web hosts offer instructions for installing PHP from your control panel.
Screenshot via WhoIsHostingThis.
Does PHP Hosting Cost More?
PHP should not add any additional cost to your web hosting fees, but it’s always a good idea to confirm support for this (or any other) application with your host when choosing a plan.
For example, all of Siteground’s plans come with PHP, including the cheapest one.
Screenshot via WhoIsHostingThis.
How PHP Changed the Web
In the early days of the web, content was created in text editors using raw HTML. Occasionally, a page creator would throw in a bitmap image to liven things up.
With the advent of PHP, websites became more dynamic, more responsive and faster to create.
Different Versions of PHP
PHP was originally rolled out in 1995, and the most important subsequent release was arguably version 5. In total, it took five years for PHP to become a common feature on web hosting accounts.
|PHP 4||Although some hosts do offer PHP 4 for legacy sites, it is no longer supported officially, and it’s advisable to transition older websites to the newer version 5 or above.|
|PHP 5||In PHP 5, there was a more sophisticated approach to object oriented programming, marking a leap forward in functionality and ease of use.|
|PHP 7||At the time of this writing, we’re on version 7.2 of PHP. (Version 6 was abandoned due to various resource problems.)|
Survey data of PHP versions being used from W3Techs as of December 2017.
Pie chart via WhoIsHostingThis.
Why Use PHP?
PHP connects HTML pages to dynamic content from databases and multimedia applications, making it easy to create interactive content.
There are many reasons to use PHP to develop your site:
- It’s favored by beginners because it can be incorporated into HTML documents. The PHP interpreter will only read the items enclosed within delimiters. Everything else is processed as regular HTML. This makes it easy to add small dynamic chunks of code to an existing site.
- It’s a lightweight option that can be run on all kinds of hosting accounts.
- Finding a PHP web host is relatively easy; PHP is free, so most hosts included it in their hosting plans.
- It allows you to pull content from a database, meaning that one page template can be populated with different content.
- PHP can’t be read by the visitor, to it’s ideal for secure applications, such as authorization and payment processing.
- If it’s not installed, you may be able to install it yourself through your control panel.
- You’ll need PHP to run WordPress and many similar applications.
Survey data of sites and traffic by language used from W3Techs as of December 2017. Scatter chart via WhoIsHostingThis.
What to Look for in PHP Hosting Plans
Most hosting packages come with PHP support at no extra cost — including free web host plans or inexpensive shared plans that offer an unlimited resource allocation and a free domain name.
These plans most likely also include a range of PHP scripts that you can install to enhance your website. Many hosts also provide technical support for such scripts, which is not the case if you decide to use a less commonly-used language.
As such, you can rest assured that you’ll find a great PHP hosting option at a price you can afford.
>Pullquote: PHP is the scripting language that drives all of WordPress, and without PHP, your server will not be able to interpret the pages that create your weblog. Source: WordPress Codex FAQs.
WordPress basic configuration coding in PHP. Screenshot via WhoIsHostingThis.
How to Learn PHP
Learning PHP is simple; there are lots of little tutorials that will help you get started, like:
- Video: Learn PHP in 15 Minutes
There are plenty of free PHP tutorials, like the one by Jake Wright on YouTube. Screenshot via WhoIsHostingThis.
PHP Hosting Caveats
While many web hosts support PHP, it’s crucial to check which versions they support before you purchase a web hosting package.
WordPress Recommends Prompt PHP Updates
WordPress, a content management system that is a major driver of PHP support in web hosting, recommends that you select an option that upgrades to the latest version of PHP to ensure a secure environment.
Why Some Hosting Companies Delay PHP Updates
However, some hosts are loath to upgrade immediately (or even soon after) a new release, since they aren’t certain that the new version won’t be “buggy.” As such, you’ll also want to check the host’s upgrade policy.
PRO TIP: To protect your site’s security, make sure to keep PHP updated to the latest version.
Linux vs Windows for PHP
PHP was originally written for Linux web servers, but it can now be installed on most operating systems and platforms. It’s possible to run PHP version 5.3 and above on Windows web servers offered via your hosting provider.
HostGator’s PHP version recommendations for Linux. Screenshot via WhoIsHostingThis.
HostGator’s PHP version recommendations for Windows. Screenshot via WhoIsHostingThis.
Why Choose Linux Hosting for PHP?
However, there are a few secondary reasons why you might not choose Windows when it comes to PHP web hosting and running PHP scripts:
- Historically, Linux and PHP are closely linked. Finding support for scripts running on Windows servers can be difficult.
- There’s more work involved for the web hosting company, so they might not be so keen to support it.
- Windows hosting usually costs more, so it’s better not to choose it unless you have a particular reason.
Linux powers the majority of sites on the web. Don’t choose a Windows server if you don’t need it for any other purpose, since Linux and PHP are a great combination.
Linux hosts 66.9% of all web servers compared to 33.1% for Windows 33.1% servers. Source: W3Tech.com as of December 2017. Image via WhoIsHostingThis
PHP Terminology and Acronyms
When buying a hosting account for PHP support, you may come across some of the following terms and abbreviations:
|PHP||PHP is a recursive acronym. It stands for PHP Hypertext Processor. Originally, it stood for Personal Home Page.|
|Foo||Foo is a term used as a placeholder or wildcard. You’ll see it on PHP forums, in working code and in examples online.|
|PEAR||The PHP Extension and Application Repository, a code library that simplifies and speeds up web development.|
|LAMP||A common hosting set-up: Linux, Apache (web server), MySQL (database) and PHP. LAMP is sometimes referred to as a “LAMP stack,” or a solution stack.|
|Zend||Zend is a software company that develops PHP applications. Its products include the Zend Engine, the driving force behind the execution of PHP code.|
My Choices: The Top Three PHP Hosts
- SiteGround: SiteGround bills itself as web hosting that’s been “crafted with care,” and we agree. In addition to offering a full slate of feature-rich options at a variety of price points, SiteGround treats its customers well (over 1000 customers have contributed to its 4.99/5 star rating), owns data centers in three continents, implements technology to ensure top-notch performance, and offers an uptime of 99.99%.
SiteGround’s PHP version manager. Image via WhoIsHostingThis
- BlueHost: BlueHost is known for its close collaboration with and optimal support for WordPress, but the host offers a myriad of options that will appeal to those looking for web hosting (regardless of whether they’re using WordPress or not). BlueHost is a solid provider of full-featured hosting plans at a range of levels/prices, and offers 24/7 support, a money-back guarantee, and extras such as marketing credits with all purchases.
BlueHost’s PHP MyAdmin panel. Image via WhoIsHostingThis.
- iPage: If you want a web hosting package that is as easy to use as possible and you want to get your website up and running with little hassle, iPage is the host for you. Though iPage’s plans aren’t as robust as those offered by SiteGround and BlueHost, you will still get everything you need to launch your website. What makes iPage stand out, however, is its the configuration of its administrative areas. iPage strives to make website management as easy as possible for you.
iPage’s PHP panel. Image via WhoIsHostingThis.
PHP Hosting Pros and Cons
Like all languages, PHP has its good and bad points. Here are main things in both categories to think about.
- PHP is lightweight, easy to learn and use, and cannot be read by end users, so you can use it for secure apps.
- PHP is commonly-supported, so you don’t have to upgrade to an advanced hosting option, such as VPS or dedicated hosting, to support your website or apps.
- If parts of your app/website require Windows-only tools, you may have a hard time finding a solid hosting option that meets all of your requirements.
More PHP Resources
Other features in Languages and Frameworks
- .NET Framework
- Ruby on Rails
- Server Side Includes
- PHP 5
- PHP 7
PHP Frequently Asked Questions
- What is PHP?
PHP is an interpreted scripting language used to create dynamic web applications.
- What is an interpreted scripting language?
An application written in an interpreted language is processed in its original form. This is in contrast to code written in a compiled language which must be converted into executable machine code before it is run.
A scripting language is one designed to write scripts to be executed within a specific processing environment such as on a web server rather than packaged up as a standalone application.
When we say that PHP is an interpreted scripting language we mean that PHP is interpreted rather than compiled and PHP scripts are executed within the context of a web server.
The distinction between interpreted scripting and compiled scripts is getting harder to make. HHVM (HipHop Virtual Machine) is a relatively new execution engine for PHP that compiles and then translates PHP into machine code prior to execution, effectively treating PHP as a compiled language rather than an interpreted language.
- What is a dynamic web application?
A dynamic website or web application is a website that pulls information out of a database or changes the content of the page based on user input, in contrast to a static website which simply displays non-changing content.
- Are scripting languages less powerful than compiled languages?
PHP is a complete programming language. From the standpoint of building web applications, you can do pretty much anything you need with PHP. However, PHP is not sufficiently “low-level” to manipulate the machine that it is running on which is why you’ll (probably) never see an operating system built in PHP.
So, PHP is less powerful than a compiled programming language such as C because it isn’t adequate for manipulating a machine directly. However, in a very real sense, it’s far more powerful than C because it would take far less time and effort to develop a web-based content management system with PHP than with C.
- What does PHP stand for?
It originally was an acronym for Personal Home Page tools. With the release of PHP 3, a recursive acronym was invented and PHP now stands for PHP: Hypertext Preprocessor. Try not to think about it because as recursive acronyms go, it’s not very good.
- Why are so many popular applications written in PHP?
PHP has been included as part of the industry-standard web server configuration referred to as the LAMP stack (Linux, Apache, MySQL, and PHP, Perl, or Python) since the late 1990s. Its ubiquity, open-source roots, and ease of use make it a natural fit for the web.
PHP has somewhat fallen out of favor with modern web developers. However, the massive installed PHP base and the fact that popular applications such as WordPress are written in PHP mean that PHP isn’t going anywhere soon.
- Is PHP popular?
PHP is incredibly common. However, some modern programmers dislike the language for reasons that are rooted in the fact that the original developer never intended to create a programming language and wasn’t really qualified to do so.
- Do I need PHP?
Many modern web applications such as content management systems and ecommerce platforms are written in PHP. If you’re planning to use a PHP application it is important that your web hosting provider supports PHP.
Additionally, there are a number of PHP modules that might be needed by any particular program. Virtually all hosting plans include PHP.
However, you should research the specific modules and PHP versions requirements of the applications you plan to use and then check with your web host to verify that they can meet these requirements.
- Do I need to learn PHP?
You only need to learn PHP if you’re going to create or modify PHP applications. You do not need to know PHP to use most popular PHP applications such as WordPress and Joomla. Although, knowing at least basic PHP will help you troubleshoot any issues you run into when using a PHP application.
- Who should learn PHP?
Virtually all web developers should know PHP. It’s the most common server-side language, so web developers are almost certain to run into it on a regular basis. It’s also relatively easy and natural to learn.
There are a lot of good tutorials and other educational materials available because of the number of applications written in PHP. A lot of web developers get their start working on WordPress, Joomla, or Drupal – all written in PHP.
It’s a natural progression for a budding developer to go from tinkering with a WordPress theme to modifying a basic plugin, to developing their own themes and plugins.
- How do I display static HTML as part of a PHP script?
PHP was designed to be mixed with HTML. In a PHP script, you can jump back and forth between writing HTML and PHP. In addition, you can use the PHP functions echo and printf to print out HTML. This makes PHP much easier to work with than other languages for creating web applications.
- What is a PHP framework?
A PHP framework is a set of classes designed to make development faster and more secure.
Each PHP framework includes a different set of classes and is designed with different development goals in mind, so picking the right framework is important. The most popular PHP framework is Zend, which is developed by the same company that underwrites the development of PHP.
Two other popular frameworks are Laravel and CodeIgniter, and there are dozens of other PHP frameworks that can speed up your development and help ensure that you follow best coding practices.
- What’s new in PHP 7?
The most important upgrade in PHP 7 is speed. In benchmarked tests, PHP 7 has been demonstrated to be at least twice as fast as the previous version of PHP, version 5.6.
PHP 7 also includes enhancements to error handling, variable type declaration, a more secure random number generator, limited Unicode support, and a new spaceship operator () that can be used to test for the relationship between two values.
- What happened to PHP 6?
Quite a bit of work was done developing PHP 6 with the goal of adding complete native Unicode support to PHP. However, the project faltered and some of the work was eventually pushed back into a minor version releases of PHP 5 while full support for Unicode was never added.
When work on the next version of PHP began, originally called PHP Next Generation (phpng), the decision was made to name the version PHP 7 to avoid creating any confusion as to whether or not the features tabbed for inclusion in PHP 6 had been included.
- Can I use PHP 5?
The final version of PHP 5 was 5.6 which was released in August of 2016. It received active support for both bug and security fixes through January of 2017 and it will receive critical security updates through the end of 2018.
However, beyond that timeframe, any new security issues will not be patched and you should avoid using PHP 5 beyond the end of 2018.
- Is PHP secure?
PHP can be used to build secure web applications. However, it is also quite easy for inexperienced developers to introduce significant security loopholes into their web applications if they aren’t careful.
If you’re building a publicly-accessible web application, take the time to educate yourself about the most common security threats that PHP developers face and make sure you’ve protected against these pitfalls in your codebase.
- How do I get PHP?
PHP is pre-installed on virtually all managed web servers. However, if you’re going to manage your own VPS, cloud, or dedicated server, then you may need to install PHP.
There are many different ways to install PHP depending on the operating system on your server and the web server software you’ll be using alongside PHP. In general, you’ll install PHP by connecting to your server over SSH and running a series of commands.
Detailed installation instructions are available from the official PHP website: PHP.net.