LoginSignup
0

More than 1 year has passed since last update.

windowsでマルチPHPを実現する

Last updated at Posted at 2021-11-18

PHPをダウンロードし、任意のディレクトリにダウンロード

ここでは/c/php/php-7.1.17-nts-Win32-VC14-x64

環境変数に下記を追加

C:\php

PHPのエイリアスを作成

git-bash用

vi /c/php/php

#!/usr/bin/bash
"/c/php/php-7.1.17-nts-Win32-VC14-x64/php.exe" $*

cmd用

vi /c/php/php.bat

@echo off
"C:\php\php-7.1.17-nts-Win32-VC14-x64/php.exe" %*

vi ~/.bash_profile

#alias php='/c/php/php-7.3.31-nts-Win32-VC15-x64/php'
alias php='/c/php/php-7.1.17-nts-Win32-VC14-x64/php'

git-bash反映

. ~/.bash_profile

バージョン確認

$ php -v
PHP 7.1.17 (cli) (built: Apr 25 2018 02:18:57) ( NTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0