photo of a laptop on a desk

What is PHP and why is it important?

WordPress shouldn’t need much introduction, it is still the most widely used Content management system powering around 37% of all websites on the web. There are endless learning resources and experienced developers on the market, lots of global communities organising regular meetups and countless web agencies focused predominantly on WordPress development, if you were attending a party of web technologies then WordPress would be a recognisable face at the party.

But at this metaphorical party would you recognise PHP? If not, then you really should get introduced, because WordPress owes its success to the language that powers over 88% of all the websites on the web.

What is PHP?

PHP is the programming language that WordPress is built on. It’s a server-side scripting language which can store and retrieve data from a database and is used to power WordPress themes, plugins and the core functionality of the WordPress system. As a non-developer, that might sound a tad complicated, but rest assured, you don’t need to know how to program PHP to run a WordPress site. However, it is good to know what it is and why it’s important.

In layman’s terms, PHP does a lot to make sure your site and it’s content are delivered to your users. Here are some of the main reasons how it came to be so integral to WordPress:

  • It’s free
  • It can interact well with the database system MySQL, which is also free
  • Compared with other languages it’s easy to learn
  • There are a lot of online resources to help you learn PHP (so plenty of places to ask for help!)
  • There are a lot of experienced developers available to build WordPress-based things that don’t necessarily charge as much as developers working on the latest bleeding-edge technologies

However, if you’d pick the brain of a developer, they would give you these more specific things it does:

  • Retrieves and stores data in a database 
  • Authenticates users
  • Reads data from files
  • Checks user permissions

Now, this is not a list of tasks exclusive to PHP, but it was probably the best fit at the time of WordPress’s inception. Since WordPress was started way back in 2003, changing its underlying core technology could be very disruptive.

Why PHP?

This has certainly been exclaimed by frustrated developers many times in the past. It is no secret that many have found the language and its libraries frustrating to work with and there has admittedly been room for improvement over the years. But luckily for all involved in WordPress, this is something that the latest versions of PHP are changing.

The inconsistencies amongst its function names and parameter ordering, one of the main grievances other developers have with the language, actually stem from the fact PHP was not originally designed. Instead, it grew organically. Its creator Rasmus Lerdorf was working on his little project to help him build a website back in 1998 by adding “the next logical step along the way”, leading to its continuous evolution over the years.

PHP has also remained an easy language to pick up, partly because it is not strict on certain ways things need to be built (i.e allows for a string input when a number should be used which could introduce logic errors).  

Though, the original PHP was a different beast to the tech that is employed today. It is more complex, meaning it can throw errors within streams of code. Professional developers use powerful debugging tools and frameworks to greatly reduce the kind of errors that PHP used to permit as there are now numerous significant improvements in the latest versions of PHP that push towards cleaner code. If you’re looking for online resources to learn and master coding, there are a lot of online course providers on the internet. If you want to know if they are credible enough, you must first check out their reviews, such as that review of Coursera, for example.

But still, one reason PHP remained a good fit for WordPress was its compatibility with several other technologies that created the perfect ‘software stack’ sufficient for running most websites, including CMS driven ones such as WordPress, Joomla and Drupal.

WordPress has been able to offer up the famous five-minute install because, generally, you were installing on a machine that already had everything you needed installing, and it was/is all free.  So the wide distribution of PHP more than likely assisted WordPress is becoming the most widely used CMS today.

What are the alternatives to PHP 

With regard to WordPress, development developers aren’t entirely limited to PHP.  The REST API allows for front-end builds using modern JS frameworks (frameworks such as Gatsby springs to mind).  

But it is down to whatever is the best fit for the job. A well-configured WordPress site with sophisticated caching can still perform very well and possibly better than some of this bleeding-edge tech. One ambitious project to deliver up a large WordPress site via a Gatsby static site suffered serious SEO penalties, proving that PHP isn’t old hat.

Also, the latest WordPress components such as the Gutenberg building blocks are getting built using REACT (another popular modern Javascript framework).  So although the core functionality is built using PHP, future components are seemingly moving more towards modern and dare I say trendier languages.

Though, it’s worth noting this could well be a push to garner interest from younger developers, the PHP Reddit user group has 125k members, the Javascript group on Reddit has 1.3m members.  

That being said, there is no major risk of WordPress suddenly moving from PHP to JavaScript. Whilst it would be foolish to ignore the seismic shift towards Javascript over the last few years as the language of the internet, WordPress just has one foot firmly rooted in its PHP past and it’s unlikely to move beyond it.

In summary, it’s essential

PHP, though it is surrounded by competition, is ultimately integral to WordPress. Both its history with the open source platform and its accessibility means it’s here to stay. However, it’s important to note that PHP is essential because of its regular updates. These ensure your website is fast and secure, however, as we said, PHP can throw errors if not updated or input correctly. To help with the latest, and most breaking, PHP update, we’ve created a PHP 8 Survival Guide.

For further information about PHP, you can rely on outlets like Stitcher, Laravel, and even Reddit.

Looking for help with your WordPress website? Or have some questions about PHP? Let’s have a chat over coffee.

Graeme

Signup to our mailing list