DEV Community

Cover image for Forget XAMPP! Create a dev environment | Part 1 | Install PHP
Horváth Gergely
Horváth Gergely

Posted on

Forget XAMPP! Create a dev environment | Part 1 | Install PHP

It's easy right? Just pushing your stuff into a directory somewhere on your pc then accessing it from a url?

Well yeah, then you want to deploy your project into production and it breaks because of the url rules you had to set up in order to be able to work on it.

In this article i will show you how i do it after 2 years ( and i still have much to learn )

Prerequisities

You need some kind of package manager first. If you're on linux you're safe. Just

$ sudo apt-get install php7.3
Enter fullscreen mode Exit fullscreen mode

But most of you reading this article for better practices aren't using linux. If you were, you wouldn't need this I'm sure. So, here you go then, package manager for Windows.

Windows

Wait what? Is there a package manager for Windows?

Well duh, ofc you dumbass. If you did not heard about it, you may've been sleeping under a rock or i dunno.

You can find everything here: https://chocolatey.org/install

Then it's just a matter of

choco install php --version 7.3
Enter fullscreen mode Exit fullscreen mode

This command. You will find the php runtime library after the installation at "X:\tools\php". Since choco will adjust your environmental variables, you don't need to do anything after this, just reopen your terminal and enter:

Please note that you may have to restart your terminal to make the changes take effect ( if you are using cmd or powershell )

php -v
Enter fullscreen mode Exit fullscreen mode

If you've done everything right, you should see the php version and the build number and some other weird stuff you may don't really understand yet. 😄

Mac OS

Homebrew. Did you heard about it? You will need it.
It's quite essential for a Mac if you're a developer.

Here, follow this link and install: https://brew.sh/

If everything went smooth you should be able to install the php runtime library by entering this:

$ brew install php@7.3
Enter fullscreen mode Exit fullscreen mode

You can find Part 2 here:

Top comments (0)