Get your LAMP stack up and running in 10 minutes
Today I was looking for at way to test some php code quickly and easily.
My first thought was to log on to my web hosting provider, create a subdirectory and upload the code.
Basically not a good idea on so many levels
But hey, it’s only going to be there for a short period of time while I’m testing…
First of all the big: DON’T put test code along with your production code, EVER! I know techies are lazy people, but we should have learned by now why it’s generally a bad idea.
Then there is the issue with clutter and actually it’s also kind of cumbersome to work with. In this case I also needed a DB to go along with the code.
From exploring projects such as Laravel, I knew there was a better way so I went to explore the Vagrant platform that Laravel suggests using when building Laravel projects. But the Vigrant platform can be a little hard to work with initially and it actually also takes quite some resources from your computer.
But on their site they had a comparison between competitors doing similar technology. Enter Docker.
Maybe I should have started my search there, but hey, live and learn! The important thing is that I eventually got there.
Docker provides a platform for containers to live and unless you have been living under a rock, containers is the craze and has been for some years now.
But the container is only the facilitator, we need to get the LAMP stack up and running on that container. So are a short trip to google I found Devilbox.
Now I’m running this on a mac, but it doesn’t make any difference. This could be used on linux and windows as well.
Basically here’s what needs to be done:
- Download and install Docker Desktop
- Clone the Devilbox git repo
- Edit the .env file and change the user/group ID to match that of your computer (other settings are optional)
- Start the container with “docker-compose”
It’s so easy and the Devilbox documentation is really good and easy to get started with.
So there is no excuse, get you LAMP stack up and running in no time with the added benefit of learning something about containers along the way.