前提・実現したいこと
XAMPPでPHP(7.2,7.1,5.6,5.5,5.4)の切り替えを行いたい
XAMPP本体はxampp-windows-x64-7.1.30-5-VC14.zipを利用しています。
以下の記事を参考に、複数のPHPを格納しました。
1つのXAMPPでPHPのバージョンを切り替えて使う最もシンプルな方法
xamppで複数のバージョンのphpを切り替えて使いたい!!!
XAMPPで複数のPHPを切り替える
PHP切り替えのバッチファイルも作成し、シンボリックリンクの書き換えができていることも確認しました。
batch
1@echo off 2 3echo. 4echo phpのバージョンを確認します。 5echo. 6php -v 7echo. 8echo 1: PHP 5.4 9echo 2: PHP 5.5 10echo 3: PHP 5.6 11echo 4: PHP 7.1 12echo 5: PHP 7.2 13echo C: Cancel 14echo. 15echo 現在のバージョンを変更する場合は1~5を選択してください。 16 17choice /c 12345C /M "Choose the version of PHP." 18echo %errorlevel% 19if %errorlevel% equ 1 goto PHP_54 20if %errorlevel% equ 2 goto PHP_55 21if %errorlevel% equ 3 goto PHP_56 22if %errorlevel% equ 4 goto PHP_71 23if %errorlevel% equ 5 goto PHP_72 24goto OnExit 25 26:PHP_54 27echo php5.4に変更します。 28del C:\xampp\apache\conf\extra\httpd-xampp.conf 29mklink C:\xampp\apache\conf\extra\httpd-xampp.conf C:\xampp\apache\conf\extra\httpd-xampp.conf54 30rmdir C:\xampp\php 31mklink /D C:\xampp\php C:\xampp\php54 32goto OnExit 33 34:PHP_55 35echo php5.5に変更します。 36del C:\xampp\apache\conf\extra\httpd-xampp.conf 37mklink C:\xampp\apache\conf\extra\httpd-xampp.conf C:\xampp\apache\conf\extra\httpd-xampp.conf55 38rmdir C:\xampp\php 39mklink /D C:\xampp\php C:\xampp\php55 40goto OnExit 41 42:PHP_56 43echo php5.6に変更します。 44del C:\xampp\apache\conf\extra\httpd-xampp.conf 45mklink C:\xampp\apache\conf\extra\httpd-xampp.conf C:\xampp\apache\conf\extra\httpd-xampp.conf56 46rmdir C:\xampp\php 47mklink /D C:\xampp\php C:\xampp\php56 48goto OnExit 49 50:PHP_71 51echo php7.1に変更します。 52del C:\xampp\apache\conf\extra\httpd-xampp.conf 53mklink C:\xampp\apache\conf\extra\httpd-xampp.conf C:\xampp\apache\conf\extra\httpd-xampp.conf71 54rmdir C:\xampp\php 55mklink /D C:\xampp\php C:\xampp\php71 56goto OnExit 57 58:PHP_72 59echo php7.2に変更します。 60del C:\xampp\apache\conf\extra\httpd-xampp.conf 61mklink C:\xampp\apache\conf\extra\httpd-xampp.conf C:\xampp\apache\conf\extra\httpd-xampp.conf72 62rmdir C:\xampp\php 63mklink /D C:\xampp\php C:\xampp\php72 64goto OnExit 65 66 67:OnExit 68
発生している問題・エラーメッセージ
PHP7系⇔5系の切り替えがうまくいかない
切り替えバッチを実行し、シンボリックリンクが変更された(ファイル作成日時で判定)ことを確認し、Apacheを起動すると以下のエラーが発生
[Apache] Error: Apache shutdown unexpectedly. [Apache] This may be due to a blocked port, missing dependencies, [Apache] improper privileges, a crash, or a shutdown by another method. [Apache] Press the Logs button to view error logs and check [Apache] the Windows Event Viewer for more clues [Apache] If you need more help, copy and post this [Apache] entire log window on the forums
再度切り替えバッチを起動するとphp -vによりPHPのバージョンが変わっていることが確認できました。
また、7系を選択すると正常に起動できます。
なにか作業漏れがあるでしょうか。ご指摘いただけると幸いです。
以上、よろしくお願いします。
apache error_log
PHP7.2起動→停止→5.6変更→起動(エラーで終了)→7.1変更→起動→停止
上記の作業を行いエラーログを出力しましたが、エラーログにはPHP5.6起動時のログがありませんでした。
#PHP7.2起動 [ssl:warn] [pid 19296:tid 812] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [core:warn] [pid 19296:tid 812] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [ssl:warn] [pid 19296:tid 812] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [mpm_winnt:notice] [pid 19296:tid 812] AH00455: Apache/2.4.39 (Win64) OpenSSL/1.1.1c PHP/7.2.20 configured -- resuming normal operations [mpm_winnt:notice] [pid 19296:tid 812] AH00456: Apache Lounge VC15 Server built: May 29 2019 11:22:50 [core:notice] [pid 19296:tid 812] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/xampp/apache' [mpm_winnt:notice] [pid 19296:tid 812] AH00418: Parent: Created child process 8408 [Wed Jul 24 11:38:23.834214 2019] which matches the server name [ssl:warn] [pid 8408:tid 688] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [mpm_winnt:notice] [pid 8408:tid 688] AH00354: Child: Starting 150 worker threads. #この間にPHP5.6に変更し起動エラーを起こしている #PHP7.1起動 [ssl:warn] [pid 22256:tid 716] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [core:warn] [pid 22256:tid 716] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [ssl:warn] [pid 22256:tid 716] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [[mpm_winnt:notice] [pid 22256:tid 716] AH00455: Apache/2.4.39 (Win64) OpenSSL/1.1.1c PHP/7.1.30 configured -- resuming normal operations [mpm_winnt:notice] [pid 22256:tid 716] AH00456: Apache Lounge VC15 Server built: May 29 2019 11:22:50 [core:notice] [pid 22256:tid 716] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/xampp/apache' [mpm_winnt:notice] [pid 22256:tid 716] AH00418: Parent: Created child process 16816 [ssl:warn] [pid 16816:tid 604] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [ssl:warn] [pid 16816:tid 604] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name [mpm_winnt:notice] [pid 16816:tid 604] AH00354: Child: Starting 150 worker threads.
Windowsイベントログ
Windowsログ>システム
「xampp」で検索したところ以下のエラーを発見しました。
ただ発生時間が切り替え操作時でなくPCシャットダウンした時間のようなので、XAMPPを立ち上げたまま終了しようとしたために発生したものかもしれません。
Caption XAMPP Control Panel v3.2.4 [ Compiled: Jun 5th 2019 ]: xampp-control.exe - アプリケーション エラー Message 0x000000000065B2AE の命令が 0x0000000000000042 のメモリを参照しました。メモリが read になることはできませんでした。 プログラムを終了するには [OK] をクリックしてください
回答1件
あなたの回答
tips
プレビュー