-
Notifications
You must be signed in to change notification settings - Fork 0
PHPソースコードを読む環境
Ryo Tomidokoro edited this page Feb 9, 2020
·
2 revisions
ソースコードをステップ実行しながら読むための環境は、以下の条件を満たす必要があります。
- PHPをソースコードからコンパイル出来ること
- gdb(GNU Debugger)が利用できること
現在、市場に存在する主なOSは、Windows, Mac OSX, Linux(Ubuntu, CentOS等)です。
この中で、本手順が推奨するのはLinuxです。
Mac OSXは、gccではなくclang(llvm)を使っています。llvmのデバッガーはlldvであり、gdbと同じような機能は提供されているのですが、少しずつ異なります。 残念ながら統計データは見つけられなかったのですが、 実際にPHPが動作する本番環境は、Ubuntu, CentOS等に代表されるLinuxサーバーが過半を占めると想像します。 コンテナもLinuxですので、デバッグ実行をしつつPHPのソースコードを読む環境は、Linuxであることが望ましいです。
Mac OSXやWindows環境の方は、Vagrant等を使ってUbuntu 16.04LTS~18.04LTS, またはCentOS7をインストールして下さい。 ラップトップにUbuntu desktopをインストールしている方は、そのままで大丈夫です。
※本番環境にWindowsサーバーを使っているような場合においては、Windows環境においてビルドやデバッグを行うと良いと思います。
Linuxであれば、Cのコンパイラとしてgccがインストールされますので、通常はgdbも一緒にインストールされているはずです。下記のコマンドで確認出来ます。
$ gdb --version
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".