James Galley

Web application developer

PHP, Yii, MySQL, Node.js - JavaScript, HTML, CSS & SASS - Linux, AWS & serverless

Migrating legacy PHP web applications to the cloud

Existing legacy PHP web applications can be modernised and migrated to the cloud to realise the benefits of scalability and reliability. This is sometimes refered to as lift and shift, and put simply, is the act of moving your web application to a new home on cloud hosting.

I've migrated many PHP websites and applications to AWS cloud hosting, it's a process that can be performed with no disruption to your website or business, and which brings fantastic benefits for speed, security and cost.

Why migrate to the cloud?

Traditional single-server or shared hosting servers are often used to host websites and PHP web applications. However with the availabilty of cost-effective cloud hosting from providers like Amazon Web Services and Microsoft Azure, there's now far more choice in how you choose to host a web-based systems.

The typical £5-a-month shared hosting packages are cheap and cheerful and easy to get started with. But these types of hosting host other websites on the same servers, meaning your website can be affected by the traffic and security issues of other websites.

Migrating your website or application to the cloud means you can have your own dedicated server resources for a fraction of the cost. For a website it may be possible to deploy it as a 'static website' on services like AWS S3 (like this site!) which makes it blazing fast, completely secure and almost free to host.

Breaking down the monolith

PHP applications or websites built in frameworks like Yii, Laravel or CodeIgniter are often built as 'monolithc' applications, with all the functionality and infrastructure within the same codebase, and hosted on a single Linux or Windows server. This approach has been perfectly valid for a long time, however now with the explosion of cloud services such as AWS, Azure and Google Cloud Platform and the availability of scalable infrastructure and serverless technology, it's a good time to consider whether your application could benefit from modernisation.

A review your application may reveal areas which could be separated out into microservices or discrete applications, decoupling them from the 'monolith' and allowing the use of more efficient, often cheaper hosting infrastructure.

Scalability

A web application hosted on a single VPS or Dedicated server will have a ceiling limit of users or activity. A single server has finite resources of CPU power, memory, disk storage and network throughput.

I've lost count of the times I've visited the website of a business featured on a TV program as I'm watching it - and found the website server overloaded and unresponsive.

The only way to ensure that you don't exceed the finite limits of a single server is to provision a much larger server than you think you'll ever need. This is expensive and unnecessary.

With cloud infrastructure you can build scalable architecture which grows to match demand or traffic to your website. While demand is low, the costs are cheaper. But if you receive an unexpected spike in traffic, the infrastructure scales up to match.

Reliability

What happens if your single Linux server has a problem? Your website or web application is down, maybe your email is down - your business is at a standstill.

In the modern era of cloud computing this should never happen, as cloud infrastructure can be configured to be self-healing and redundant, with your systems replicated in multiple regions and availability zones so that a failure in any one location does not affect the availability of your systems or the running of your business.

Other benefits of migrating applications to the cloud

The process of migrating a legacy PHP application to the cloud inevitably involves a review of the whole application, revealing opportunities for performance and security improvements.

Migrating to the cloud usually requires some changes to the deployment and management processes (what we call DevOps), and this can lead to improvements in deployment reliability and backup routines