Categories
Laravel Development

The best web hosting for Laravel 8

Where to host Laravel (Laravel 8) installation? Obviously, you can install Laravel locally, on your laptop, but we will not analyse such scenario here. Your local Laravel website will not be visible to the outside world, unless you go with dynamic DNS messy route.

There are many web hosting companies offering Laravel installations, they promise all you need to install the latest Laravel. However, keep in mind, that many of them are optimised for older Laravel versions, or they expect you will host WordPress. The problem is, that Laravel 8 is somehow different than earlier versions, there are some rather important differences (Laravel 8 has Jetstream, different authentication scaffolding, changes in routing, models location to mention just few of them). If you want to install commercial website based on Laravel, better go with version 8. So, the first question should be if web hosting can handle Laravel 8.

I found that shared web hosting in general cannot be trusted for Laravel 8. I experienced problems with node / npm packages and composer functionality. And, on top of that, memory limits can be tough. Often you just need sudo user functionality, which you will not get from cheap shared web hosting.

Also many VPS (Virtual Private Servers) don’t provide enough resources to get Laravel 8 working – they can have old software or not enough memory, or memory upgrade is really expensive.

So, what works? Well, there are few web hosting companies which provide hosting good enough, that you can develop with Laravel 8. First of all I would recommend web hosting recommended on Laravel website. Except that I found that what can be trusted are:  Digital Ocean or AWS EC2. With the web hosting providers you need knowledge of LAMP installation, basically, you create your own server from scratch, and you are responsible for your server administration, which can be very time consuming. Let’s take for instance AWS EC2 – all sounds OK, works perfect, nice administration interface on AWS, BUT you do need to manage your server yourself, and this can be – depending on project – something like part time job. The same with Digital Ocean. The web hosting companies are very reliable, but they will not manage your server – this is your responsibility, on top of pure web development.

Bear in mind, that for commercial projects you cannot trust free AWS EC2 free tier instances, because such instances will fail from time to time. So, you need paid stuff – the more memory, the better. BUT, basic hard drive space for AWS EC2 instance is only 8GiB (1GB = 10003 bytes, 1GiB = 10243 bytes), which is pretty low amount (Linux takes space, database, your archives, versions, static files, etc etc), so you would need to setup additional space, which means additional headache. In AWS they offer all bells and whistles, like additional databases, storage etc – for additional fee. Soon enough, you will find, that all this is not that cheap. It looks cheap, but only looks that way. Ultimately, as usual, you get what you pay for.

I found, that there is one more reliable option, which seems to be strange, but it works – a dedicated, standalone WHM CPanel server, based on CentOS Linux. Why WHM CPanel? Well, 8GB RAM and 250GB SSD Linux server with CPanel installed can cost you about £100 monthly. But, with WHM CPanel server administration can be very easy and fast. With Digital Ocean and AWS EC2 you have to use command line (you can use CMD on WHM CPanel server too, if you like). Is command line server administration bad? Well, not at all, but it is more time consuming – versions of every piece of server software change all the time, so not all solutions recommended on StackOverflow will work on your server. Simply speaking – in server administration there are so many moving parts, that such task can be very time consuming – WHM CPanel makes such time consuming task much easier and faster.

I had Laravel 8 installations on Digital Ocean, AWS EC2 and few selected web hostings (I set up accounts there to see what and how works). Finally, I landed with dedicated server. This is not the cheapest solution, but now I spend less time with server administration and more with Laravel development. I understand, that server administration stuff, all these droplets, Heroku, Elastic Beanstalks etc are very beautiful things, and they are advertised as easy or very easy, but I don’t care about it, I don’t have time for it. As a web developer I prefer to spend more time for development and less for server administration. It looks like a dedicated server with WHM Cpanel installed can be good both for commercial projects and for more advanced learning. It may be not the best option for very advanced projects, where Cloud Hosting as such, especially AWS, with its products/services can be very handy.

So, to cut it short, for Laravel 8 if you have a server administrator who can take server/Linux/Database/SSL and other related tasks – go with Amazon AWS stuff, if not, better use a dedicated server with WHM CPanel installed, where you can do most tasks very quickly yourself. If you cannot afford a dedicated server, you can go with Digital Ocean – less complex user interface than in Amazon AWS, but be prepared to spend more time on Linux command line, which means – you will have less time for Laravel development.