Below is a table outlining some of the differences between PHP 4 and PHP 5:
Powered by Zend Engine 1.0
Powered by Zend Engine 2
Constructor/Class names are the same
Constructor/Class names can be different
Objects Passed By Value
Objects Passed by Reference
What Does PHP Stand For?
Did you know that PHP was originally an abbreviation for Personal Home Page?
The scripting language hearkens back to the early days of the internet when people weren’t yet building entire websites, but home pages, where they would share photos, maybe family news, or whatever other tidbits of information that were important to them.
History of PHP
Websites have come a long way since then, and so has PHP, which now stands for PHP: Hypertext Preprocessor. (Yes, the first P in PHP now stands for PHP, making it a recursive acronym. It must be that developer sense of humor at work.)
PHP is a server-side scripting language designed specifically for web development.
It’s used to run a lot of well-known software, including the top four CMSs: WordPress, Joomla, Drupal, and TYPO3, plus a host of applications including Facebook.
PHP has seen numerous versions and iterations since it was first released in 1995. PHP 4 was released in 2000 and soon saw widespread adoption.
PHP 5, the current generation of PHP, was first released in 2004 but took a little longer to catch on.
Transition to PHP 5
Then in 2008, many open-source projects chose to band together to transition to PHP 5 and drop their support of PHP 4, forcing web hosting servers to upgrade to PHP 5 to stay competitive.
That same year, development of PHP 4 was officially halted, and no further patches or updates have been released since then.
But there are still some websites and software out there that run on PHP 4. And finding a web hosting provider that supports PHP 4 may be an easier, cheaper, and faster solution for you than upgrading your entire to PHP 5.
What to Look for in a PHP Host
Finding a PHP 4 host isn’t impossible, but it might take some time. Most hosts will support the latest PHP version as most hosts will have upgraded to this version to stay competitive.
However, some hosts still support PHP 4 and offer you the option to choose the version of PHP you’d like to run from PHP 5 on up.
Most hosts don’t advertise that they run the PHP 4 version, and your best course of action is to find a host that offers a wide range of versions and see if they still have PHP 4 servers available.
Beyond looking for PHP 4 compatibility you’ll want to look for the following features as well:
Advanced security features
Ample amount of storage space and bandwidth
Control panel access
Easy MySQL database creation
One click install of software like WordPress
Quality PHP Support Team
phpMyAdmin is an administration tool for MySQL and MariaDB. It is written primarily in PHP, and it has become one of the most popular tools of its kind.
It is popular, especially for web hosting services and allows users to perform tasks such as data import and export.
Advanced Security Features
Advanced security features are important in order to protect a user’s website from hackers and other dangers online.
Storage Space and Bandwidth
Storage space and bandwidth are important for any hosting service including PHP Hosting. The amount of space required will depend on the size of your project.
Control Panel Access
Control panel allows the user to manage functions and activities related to their website and hosting package.
Easy access to this functionality is important in order to effectively manage your website and hosting services effectively.
Easy MySQL Database Creation
MySQL is one of the most popular database solutions available right now. Easy creation of these databases will enhance the users PHP Hosting experience and simplify the process for new users.
One Click Install of Software like WordPress
Installing WordPress can be a somewhat cumbersome task for those uninitiated with the process. As such, one-click install functionality simplifies and automates the process for new or inexperienced users.
Quality PHP Support Team
High-quality support is essential for any type of hosting and PHP 4 hosting is no exception. An experienced and competent hosting team will ensure that users have proper assistance in the event that something goes wrong.
Points to Remember
Many web hosts have now moved on to PHP 5, and no longer support PHP 4, so trying to find a compatible host for your website might be a bit tricky.
It’s technically possible for a host to support PHP 4 and 5, but it might require some workarounds in your software in order to access the right version.
Before you sign up with a hosting provider, double check with them to see whether they’re still supporting PHP 4. If you can’t find a suitable host that supports PHP 4, you may need to consider upgrading your site to PHP 5.
It may not be as much work as you think: PHP 5 was designed to still be backward-compatible with PHP 4, so your website may still work with very few or no changes.
If you have the resources to update to PHP 5, there are plenty of benefits including active development and improved security features.
If you’re adamant about continuing to use PHP 4, check around. You may find a host that plans to continue to support it. Or you may at least be able to find one that supports it with plans to phase it out, which will give you a little more time to make the necessary changes to your site without any downtime.
My Top 3 PHP 4 hosts
Decent quality PHP 4 hosting can be difficult to come by.
Here are my top three picks for PHP 4 hosting services:
If you’re looking for a solid host that still has a few PHP 4 servers then check out InMotion.
InMotion delivers you a powerful server environment, cPanel integration, a free SSL certificate, along with a PHP knowledge base to help answer your most pressing questions. The plans are affordable, especially considering all the value you get for your money.
Another cheap option for PHP 4 hosting is HostGator. They no longer support PHP 4, and most of its servers have been upgraded to at least PHP 5, but its support desk states they may have older servers still running PHP 4.
If your server still has PHP 4 installed you can enable it via your htaccess file. With HostGator, you’ll find a solid shared host that offers unlimited bandwidth, storage, domains, and email accounts. Plus, an easy to use cPanel and a helpful support team.
There is a host that offers complete PHP 4 hosting and it’s called Web Host Face.
The packages offered are incredibly cheap and you’ll get a hosting environment completely optimized for PHP 4. With the basic plans, you’ll get a solid amount of storage, unlimited bandwidth, free SSH access, and a free SSL certificate. To install PHP 4 on this host you can put in a request with the support staff.
PHP 4 is an old version of the PHP programming language. (PHP 5 was released in 2004.)
What is PHP 4 hosting?
This is a hosting is a niche service for users who require an outdated version of PHP on their server. Most hosts now run PHP 7, although they also still support PHP 5. If you absolutely need PHP 4 hosting, you should be able to find some hosts willing to cater to your needs.
Why would I need PHP 4 support in this day and age?
Practically the only reason anyone would need PHP 4 hosting today is legacy support for old sites and software. Perhaps you have a few outdated websites that you still need to keep alive, but you don’t want to waste resources updating them. Maybe your business commissioned a few PHP 4 projects years ago, and now you’re stuck with them because the original coders are long gone.
What’s the difference between PHP 4 and PHP 5?
PHP 5 offers a lot more features and capabilities. It has a completely overhauled object model, new class constants, a lot more automated functions and so on. It supports more functions and extensions than PHP 4.
Isn’t PHP 5 supposed to be backward compatible with PHP 4?
It is. But it is not that simple. There are a number of issues that could prevent PHP 4 code from executing on PHP 5 correctly. For example, the array_merge() function can cause a few problems if your PHP 4 coder did not follow best practices. Objects also need to have cloned keywords and PHP 5 does not consider an object with no properties empty. Certain classes can also be problematic. For example, you need to declare your classes before use.
How old is PHP 4 anyway?
PHP 4 is ancient by tech standards. It was released in 2000 and soon became the de facto industry standard. PHP 5 was released just four years later, in 2004, but its adoption was relatively slow. PHP 5 adoption picked up in 2008 when a number of big open-source projects decided to transition to PHP 5 and drop support for PHP 4. Official development of PHP 4 was halted in 2008, and no updates or patches (bug fixes) have been published since then.
Can a host support both PHP 4 and PHP 5?
Anything is possible. This would require a lot of work on your part to make sure that your project uses the right version of PHP. This may be problematic and virtually impossible on many web hosting packages. In case you really need a PHP 4 server for legacy support, chances are you will have to find one or set one up yourself, without PHP 5 support.
What about security? Is using PHP 4 risky?
Yes. Using PHP4 is inherently risky. Since there has been no development since 2008, there is no way to address security issues with new patches and versions. This means that exploits may go unchecked for years, placing you at risk. There is really not much you can do, short of migrating to a more recent version of PHP.
How hard is it to update PHP 4 code?
It depends on your skill level, but the process itself is not too complicated because PHP 5 was designed to be backward compatible. In other words, you won’t have to make many changes, just address some potential issues and that is it. The process is well documented and you should have no trouble finding useful resources online. If your PHP 4 projects were developed using best practices, chances are you won’t have much to do, so it depends on the quality of the original PHP 4 code as well.
Is it still possible to find PHP 4 hosts?
It is, but it is getting harder with each passing day. At the end of the day, it’s all a matter of demand. Fewer people need PHP 4, so fewer hosts are offering it. Depending on your needs, it may be very tricky to find an adequate host willing to deal with PHP 4. This is especially true if you are looking for shared hosting on the cheap.
It may be easier to simply update your code.
What about online PHP 4 to PHP 5 code converters? Do they really work?
It depends on the original PHP 4 code. Generally speaking, most PHP 4 to PHP 5 converters work, but their track record is mixed and can be described as a hit-and-miss affair. Luckily, you will find a lot of information on PHP 4 to PHP 5 migration online, so you should be able to find a lot of useful tips and guides.
About Kevin Wood
Kevin got his start as a web developer. Now he spends his time as a technical writer and poet. His main interests are technology and human potential. When he's not diving headfirst into technical topics, you can find him scrawling lines of poetry and getting lost in the woods.