PHP - Windows へインストール - composer


 クラウディア


1. 概要
2. ダウンロード
3. インストール
4. 備考

1. 概要

 「composer」をインストールします。  対象は、「Windows11 24H2」で「PHP 8.2.27」をインストール済の環境です。

2. ダウンロード

 ダウンロードサイトは、下記になります。
Composer
 最上部、「Windows Installer」の項の「Composer-Setup.exe」をクリックすると、インストーラをダウンロードできます。

3. インストール

 ダウンロードした、インストーラを開きます。  操作対象を全ユーザか、インストール中のユーザのみにするかをきいてきます。  わたしは、全ユーザを対象(上の方)を選択します。

 インストールタイプをきいてきます。
 「Developer Mode」のチェックはいれておいた方がいいような・・・。
 まぁ、だめだったら、インストールしなおせばいいかと・・・。
 「Next」


 インストール先をきいてきます。
 変更する場合は、「Browse...」で、フォルダ選択ダイアログが開きますので、選択します。
 決めたら、「Next」


 「PHP」の絶対パスをきいてきます。
 チェックして、変更するなりなんなりしてから。
 「Next」


 チェックが、一瞬にして終了します。

 

 プロキシの設定をして。
 「Next」


 「Install」


 これも一瞬で終わったと思いきや。


 エラーになりました。


 これは、参考サイトに載っていた事項です。


path/php.ini
 をエディタで開きます。

;extension=odbc
extension=openssl
;extension=pdo_firebird
 943行を下記へ変更します。  (行番号は、バージョンによって異なります)

extension=ext/php_openssl.dll
 とこれやって。  「Retry」  したものの・・・、これもだめ。


Script Output:
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:0A000086:SSL routines::certificate verify failed
Failed to enable crypto
Failed to open stream: operation failed
 をキーワードに。  「cacert.pem」を検索してダウンロードしたうえ。

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =

[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
;openssl.cafile=

; If openssl.cafile is not specified or if the CA file is not found, the
; directory pointed to by openssl.capath is searched for a suitable
; certificate. This value must be a correctly hashed certificate directory.
; Most users should not specify a value for this directive as PHP will
; attempt to use the OS-managed cert stores in its absence. If specified,
; this value may still be overridden on a per-stream basis via the "capath"
; SSL stream context option.
;openssl.capath=
 を下記へ書き換えて。  (行番号は、バージョンによって異なります、「path_to_cacert.pem」は、「cacert.pem」をダウンロードしたフォルダの絶対パス)

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo ="path_to_cacert.pem\cacert.pem"

[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
openssl.cafile="path_to_cacert.pem\cacert.pem"

; If openssl.cafile is not specified or if the CA file is not found, the
; directory pointed to by openssl.capath is searched for a suitable
; certificate. This value must be a correctly hashed certificate directory.
; Most users should not specify a value for this directive as PHP will
; attempt to use the OS-managed cert stores in its absence. If specified,
; this value may still be overridden on a per-stream basis via the "capath"
; SSL stream context option.
openssl.capath="path_to_cacert.pem\cacert.pem"
 に書き換えて、「Retry」したものの、解消せず。  今(2025年5月26日)ここで、手詰まりなのです。追而書

4. 備考

 本ページは、下記のサイトを参考にさせていただきました。
Composer を Windows にインストールする手順

ハイスピードプラン
【usus ウズウズ】
それがだいじWi-Fi
損保との違い
葬送のフリーレン Prime Video