Tuesday, April 16, 2024

INSTALL PHP USING COMMAND LINE TOOL FOR WINDOWS

You need to run this in powershell (Admin)

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco upgrade chocolatey 

 

choco install php 

you can specify version

choco install php --version=7.4.1 

 


last step is to update windows environment, to do that you need to run these codes.

  1. Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"

  1. Update-SessionEnvironment
php -v



And your done! :)