GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - TheDragonCode/windows-php: Easy changes and running the desired version of PHP under Windows

BranchesTags
Open more actions menu

Latest commit

 

History

120 Commits
120 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
extensions
extensions
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
windows-php.ps1
windows-php.ps1
 
 

Repository files navigation

Windows PHP Helper

Installs and switches PHP versions on Windows. It supports PHP 8.2, 8.3, 8.4, and 8.5.

Each version is installed in a separate directory. The active version is exposed through the stable modules\php junction, so applications only need one PHP path.

Requirements

  • Windows PowerShell 5.1 or PowerShell 7
  • HTTPS access to downloads.php.net, xdebug.org, and curl.se
  • Write access to the modules directory next to this repository

If Windows blocks local scripts, allow signed remote scripts for the current user:

Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

A machine or group policy can override this setting.

Directory structure

your-folder/
├── windows-php/
│   ├── bin/                 Convenience entrypoints by PHP version
│   ├── extensions/          Bundled Redis, Imagick, and rdkafka builds
│   ├── tests/
│   └── windows-php.ps1      Main script
└── modules/
    ├── php82/
    ├── php83/
    ├── php84/
    ├── php85/
    └── php -> phpXX         Active directory junction

Add your-folder\modules\php to the user PATH once:

$phpPath = 'C:\dev\modules\php'
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
[Environment]::SetEnvironmentVariable('Path', "$userPath;$phpPath", 'User')

Replace C:\dev with the actual parent directory. Open a new terminal after changing PATH.

Usage

Activate a version. It is installed first when missing:

.\windows-php.ps1 8.5

Download the latest patch release, replace the selected installation, and activate it:

.\windows-php.ps1 8.5 -Update

The version-specific entrypoints provide the same commands:

.\bin\8.5\activate.ps1
.\bin\8.5\update.ps1

Commands can be started from any current directory. An update is prepared and validated before the existing installation is replaced. A failed download or validation leaves the existing version unchanged. Treat each phpXX directory as disposable: an update replaces its php.ini and any files added manually. Xdebug output is kept separately in modules\xdebug\profiler.

PHP is installed as NTS x64. The configuration enables the bundled PHP extensions plus Redis, Imagick, rdkafka, Xdebug, and OPcache. Xdebug is disabled by default and listens on 127.0.0.1:9003 when enabled.

Verification

Run the smoke test in both shells when changing the scripts:

powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\tests\smoke.ps1
pwsh.exe -NoProfile -File .\tests\smoke.ps1

Updating this project

git pull

About

Easy changes and running the desired version of PHP under Windows

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

9 stars

Watchers

2 watching

Forks

1 fork
Report repository

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.