The easiest way to install PHP 7 (cli) on Windows 10

The default way, which is to download PHP, install, set PHP, set the environment variable in PATH and etc is unnecessarily complicated.

Just install chocolatey, which is a package manager, and then have it install PHP. In just 3 commands will be ready. Check out:

Open Windows PowerShell as Administrator (a useful shortcut and ctrl + x)

Then run the commands:

Set-ExecutionPolicy AllSigned Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient) .DownloadString ('https://chocolatey.org/install.ps1'))

Okay, now you have Chocolatey package manager, to have PHP just run:

choco install php

And the latest version of PHP will be available for command line use, and within minutes. If you are unable to run PHP, remember to close and open the terminal, or ultimately restart your computer.

If you want to know more about Chocolatey, check out the official site.

Got a question? Leave a comment.

Leave a Reply

Your email address will not be published.

en_USEnglish