phpstorm安装和调试

首先:
phpstorm是用JAVA开发的,所以在安装之前须要先安装jdk
sudo apt-get install default-jdk
从官网上下载phpstorm 的linux版本号
http://www.jetbrains.com/phpstorm/download/index.html
解压之后
进入phpstorm的bin文件夹运行安装脚本
./PhpStorm.sh
遇到激活时:
选择“License server”输入
http://idea.lanyus.com/ (已被封杀)
或者:
http://idea.qinxi1992.cn/
点击“OK”高速激活JetBrains系列产品


新建一个project写一些代码,点击执行之后,弹出浏览器,这时浏览器报错:502 bad gateway
安装sudo apt-get install php5-cgi

以下我们安装php调试工具xdebug

sudo apt-get install php5-xdebug

改动php.ini(默认位置在:etc/php5/apache2/php.ini)
在文件结尾加入:

[xdebug]
zend_extension="/usr/lib/php5/20121212/xdebug.so“
xdebug.remote_enable = On
xdebug.remote_handler = dbgp
xdebug.remote_host= localhost
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
然后保存

PHPSTORM设置

1.首先检查phpstorm的xdebug配置

这里的debug port要和php.ini里面的 xdebug.remote_port相一致!默认是9000,假设9000端口被占用的话,能够改成其它端口。



2. 设置debug.















加入本地的 web server~

www.51open.pcom 是我本地的 web server~ ~
























3.開始调试
打好第一个断点,shift + F9就能够了

打好 第一个断点 ,选中配置的debug,  按旁边的臭虫 button


 






总结:
依据断点配置。或在打开 Debug URL 的过程中。或在 POST 之后,假设 PhpStorm 监听到了 Debug 连接,就会马上切换到编辑器界面,并跳转到设置的断点处,浏览器端会等待 PhpStorm 的操作。
你能够随时中断 PhpStorm 的调试。或方便的进行 Step Into / Step Over / Run to cursor(这个刁爆了):

哎呀,不想调试了,PhpStorm 却总是跳出来?记得刚刚那个电话button嘛。再点一下,让其变成红色。就好了。


參考:http://www.cnphp6.com/archives/64729

原文地址:https://www.cnblogs.com/slgkaifa/p/7130838.html