1.在homestead virtual box安装和配置xdebug
先在终端运行vagrant up 和 vagrant ssh,ssh远程到homestead,然后复制以下代码到一个shell文件里面,并执行。
#!bash/bin
cd ~
#download and uncompress
wget https://xdebug.org/files/xdebug-2.4.0.tgz
tar xvzf xdebug-2.4..tgz#compile and make install
cd xdebug-2.4.
phpize7.
./configure --enable-xdebug
make
sudo make installmkdir -p /usr/local/php/xdebug
sudo cp ~/xdebug-2.4./modules/xdebug.so /usr/local/php/xdebug/xdebug.so
cat>>xdebug.ini<<EOF
zend_extension="/usr/local/php/xdebug/xdebug.so"
xdebug.remote_enable =
xdebug.remote_connect_back =
xdebug.remote_port =
xdebug.max_nesting_level =
EOFsudo cp xdebug.ini /etc/php/mods-available/xdebug.ini
sudo ln -snf /etc/php/mods-available/xdebug.ini /etc/php/7.0/cli/conf.d/-xdebug.ini
sudo ln -snf /etc/php/mods-available/xdebug.ini /etc/php/7.0/fpm/conf.d/-xdebug.iniservice php7.-fpm restartcd ~
sudo rm -R xdebug-2.4.
sudo rm xdebug-2.4..tgz
2.根据浏览器安装xdebug插件
Xdebug Helper for Chrome or JetBrains IDE Support
3.PHPStorm配置xdebug
3.1在导航上 Run->edit Configurations… 进入以下界面
根据上图设置保存设置。
运行debug; 设置断点,然后 运行 Run->debug,如下图:
运行成功KO!
参考资料:
https://confluence.jetbrains.com/display/PhpStorm/Xdebug+Installation+Guide