环境要求:
phpstorm2018.2.2
phpstudy php7
Xdebug v2.6.1
一、查看当前php环境信息
图中圈中的地方是我们要注意的,下载的对应的扩展。
二、开始安装redis扩展
2.1 下载redis配置文件
我这边还用到了redis,所以再配置下redis的扩展。
由于官网上都是php7版本,所以我直接就使用php7环境了。
官网:http://pecl.php.net/package/redis
下载文件:7.0 Non Thread Safe (NTS) x86
我下载了redis3.1.6稳定版,再选择redis下载版本的时候,切记要看下当前php的线程模式。
补充:
TS指Thread Safety,即线程安全,一般在IIS以ISAPI方式加载的时候选择这个版本。
NTS即None-Thread Safe,一般以fast cgi方式运行的时候选择这个版本,具有更好的性能。
2.2 在php.ini中配置扩展
将php_redis.dll复制到G:\phpStudy\php70n\ext扩展目录中,对应的目录根据实际情况来。
在php.ini中添加配置extension=php_redis.dll
重启下环境,打印phpinfo(),查看有没有redis扩展。
三、安装php xdebug扩展
3.1
我下载Xdebug 2.6.1稳定版
在phpinfo中看到电脑是x86的,所以选择32位的下载。
官网:https://xdebug.org/download.php
文件:PHP 7.0 VC14 (32 bit)
3.2 配置xdebug
将php_xdebug.dll复制到G:\phpStudy\php70n\ext扩展目录中,对应的目录根据实际情况来。
在php.ini中添加配置[XDebug]zend_extension=php_xdebug.dllxdebug.profiler_enable = Onxdebug.profiler_enable_trigger = 0xdebug.profiler_output_dir ="G:\phpStudy\tmp\xdebug"xdebug.trace_output_dir ="G:\phpStudy\tmp\xdebug"xdebug.profiler_output_name = "cache.out.%t-%s"xdebug.remote_enable = Onxdebug.remote_handler = "dbgp"xdebug.remote_host = "127.0.0.1"xdebug.remote_port = 9000xdebug.remote_mode = "req"xdebug.collect_vars = Onxdebug.collect_return = Onxdebug.collect_params = Onxdebug.idekey = PHPSTORMxdebug.auto_trace=Onxdebug.remote_autostart=Onxdebug.remote_log="G:\phpStudy\tmp\xdebug.log"
重启下环境,打印phpinfo(),查看有没有XDebug扩展。
四、配置phpstorm
4.1 打开phpStorm,快捷键Clt+Alt+S打开settings搜索Xdebug.选择下php7环境以及看下xdebug的配置。
4.2 进入Settings>PHP>Debug>DBGp Proxy。
IDEkey:填PHPSTORM,
host填test.shuchengxian.com,
port填9000
4.3 进入Settings>PHP>Servers,这里要填写服务器端的相关信息,
如:name填test.shuchengxian.com,
host填test.shuchengxian.com,
port填80,
debugger选XDebug
4.4 进入Run> Debug configurations,点+号选择PHP Web Application,
Server选填test.shuchengxian.com,
Start URL填你要访问的页面(如:/index.php),
Browser 默认或者选chrome
4.4 运行项目