phpstorm+phpstudy调试tp5:
- php版本:7.3
- apache版本:2.4.39
1、打开phpstudy–>找到软件管理–>找到对应的php版本–>设置按钮–>扩展组件–>
打开XDebug调试组件,下面Profiler输出、Trace输出都勾选上。
2、打开phpstudy–>设置–>配置文件–>找到对应php版本打开
phpstudy设置–>配置文件–>找到对应php版本,点击打开配置文件。
ctrl+f找xDebug
加上这句:xdebug.remote_autostart=1
更改这句:xdebug.remote_enable=1
加上这句:xdebug.ideakey=”PHPSTORM”
重启一下Apache
3、phpstorm导入tp5的源代码。
4、点击file–>settings–>搜索并点击PHP–>点servers–>点加号–>Name填127.0.0.1、Host填127.0.0.1–>点Apply。
5、点击Debug下的DBGp Proxy–>填写:
IDE key:PHPSTORM
Host:localhost
Port:9000
点Apply
6、点PHP–>PHP language level选择7.3版本–>点第二行后面的…–>点+号,点Local Path……–>PHP executable选择对应版本(7.3)的php.exe文件路径–>点ok。
7、开启调试
url访问:http://127.0.0.1/code_audit/thinkphp5.0/public/ 。可以正常访问就行。
打开
\application\index\controller\index.php文件,下一个断点
然后点击右上角的"小电话"开启调试模式
最后浏览器访问,若phpstorm有反应,则配置成功。
附加:解决时间一过长,调试自动结束的问题。
参考链接:https://www.moonsec.com/1881.html
1、找到对应apache版本的文件夹–>打开/conf/httpd.conf文件。
2、ctrl+f查找"Include conf/extra/httpd-default.conf",删除前面的#号;
下面加上一行:Include conf/extra/httpd-fcgid.conf 。
3、打开/conf/extra/httpd-defaulte.conf文件
- Timeout 改成 3600
- MaxKeepAliveRequests 改成 0
- KeepAliveTimeout 改成 3600
4、打开php.ini文件,ctrl+f查找"max_execution_time",它的值改为3600
5、在apache的/conf/extra文件夹下,新建文件httpd-fcgid.conf,内容:
ProcessLifeTime 3600
FcgidIOTimeout 3600
FcgidConnectTimeout 3600
FcgidOutputBufferSize 128
FcgidMaxRequestsPerProcess 1000
FcgidMinProcessesPerClass 0
FcgidMaxProcesses 16
FcgidMaxRequestLen 268435456
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
IPCConnectTimeout 3600
IPCCommTimeout 3600
FcgidIdleTimeout 3600
FcgidBusyTimeout 60000
FcgidBusyScanInterval 120
FcgidInitialEnv PHPRC "D:\phpstudy_pro\Extensions\php\php7.3.4nts"
AddHandler fcgid-script .php