Setting up PHP on Windows manually has always been pain in the ass. So this tutorial is the most simple and basic PHP setup on Windows! Follow along
First you need is PHP binary which can be downloaded here . The link that I gave you is latest version of PHP which is 8.2 . It doesn't matter you can download whichever version you want.
Once it has finished download you can extract it.
This part is important because beginners would usually think that is it a MUST to extract the PHP binary into C drive
or default drive. Actually, this is not correct you can extract it anywhere you like. For my case I have special drive for development so I put it there.
For this part, you need to create your own empty folder and name it php:
The only thing necessary that you need to setup and make your PHP works on terminal is setting up the path. For this you need to go to Windows search and search for Environment
Click on the Environment Variables...
button:
Double click on path:
Click on browse:
Browse for the folder that you have extracted PHP in the before steps, note this is important just click on the folder and make sure it is highlighted and then click Ok
:
If you have your terminal open, close it and open it back to ensure that the changes take effect. Now type on php -v
VOiLLAA! php has been installed in your machine.
Guys, you might be thinking why don't just install XAMPP, Laragon or WAMPP? I've tried all of these tools before, personally I think knowing how things work in the background is very important.
And knowing your tools in any environment is crucial, it doesn't matter if you are on Windows, Linux or MAC try your best to setup anything yourself and not rely on 3rd party services.
And also those tools are very bloated and they also install unnecessary things on your machine.
Top comments (7)
Forget this for always. Use Docker and you'll be able to play with all PHP versions, Postgresql, Mysql, ... just by editing a text file and changing f.i.
php8.2
tophp8.3
i.e. just replace2
by3
and it's done. Just one character and you're ok. Easier than this is difficult no ?docker.com/products/docker-desktop/ and hub.docker.com/_/php.
I agree with you, but some people don't have the docker knowledge. Also to create link between local file and inside docker is kinda complicated in my opinion
I agree that Docker is a knowledge to acquire and, if you're not familiar with it, it can be difficult.
If you are talking about sharing files between the host and the container, it's the notion of volume. See
-v
CLI flag or thevolume
entry incomposer.yaml
file.Nice detailed tutorial. And if you're serious with it, next step is install & learn Docker.
Laragon please. haha
hshshshsh
thank u bro