一定不要用Mac OS自帶的PHP版本。
此文主要解決,error,xdebug.c:25:10: fatal error: 'php.h' file not found
1,安裝php
>>brew search php
>>brew install [email protected]
2,解決xdebug安裝時報error
重啓Mac系統,按住command+R,打開命令行,輸入如下:
csrutil disable
等你配置好xdebug,再修改回來,否則,沒有權限操作/usr/文件夾下的內容
csrutil enable
>>xcode-select --install
>>sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include /usr/include
注意,將MacOSX10.14替換成你自己的系統版本號
上面這個命令用來解決安裝xdebug時的,error,xdebug.c:25:10: fatal error: 'php.h' file not found
3,安裝pear,即pecl命令
不再描述了,參考這裏,https://www.jianshu.com/p/598c0fd84719
4,安裝xdebug
>>sudo pecl install xdebug
5,在php.ini中配置xdebug
/usr/local/etc/php/7.1/php.ini
在最末尾部加入如下:
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.idekey = PHPSTORM
6,在phpstorm中配置debug
這一步,大家還是網上搜索吧,不再一一描述