Xdebug延长调试时间

因为我在phpstorm用xdebug调试时,没过多久就断掉然后出现500服务器错误的现象

解决办法

1. 打开apache的配置文件,在apache\conf\httpd.conf里修改

找到这一行并且把前面的注释去掉

Include conf/extra/httpd-default.conf
添加这一行

Include conf/extra/httpd-fcgid.conf
 2.在apache\conf\original\extra\httpd-default.conf里修改

直接在文档末尾处加上下面这段文字,具体时间可以自己修改

#xdebug:
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 7200
 
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
 
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 0
 
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 7200
3.在apache\conf\original\extra目录下新建一个httpd-fcgid.conf文件,这个就是我们刚才在配置文件加的,然后把下面的内容加进去

ProcessLifeTime 7200
FcgidIOTimeout 7200
FcgidConnectTimeout 7200
FcgidOutputBufferSize 128
FcgidMaxRequestsPerProcess 1000
FcgidMinProcessesPerClass 0 
FcgidMaxProcesses 16 
FcgidMaxRequestLen 268435456   
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
IPCConnectTimeout 7200
IPCCommTimeout 7200
FcgidIdleTimeout 7200
FcgidBusyTimeout 60000
FcgidBusyScanInterval 120
FcgidInitialEnv PHPRC "D:\phpstudy_pro\Extensions\php\php7.4.3nts"//这里填写你自己php的路径
AddHandler fcgid-script .php
修改完apache记得重启一下!!

4.在php的配置文件php.ini里修改

找到这一行,修改成你配置的时间

max_execution_time=7200
配置完成,你可以快乐的调试了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您好!要在 VS Code 中使用 Xdebug 进行调试,需要完成以下步骤: 1. 首先,确保您已经在 PHP 环境中安装了 Xdebug。您可以通过编辑您的 `php.ini` 文件来启用 Xdebug。在 `php.ini` 文件中,找到并取消注释以下行(如果没有则添加): ``` zend_extension = xdebug.so ``` 2. 在 VS Code 中安装 PHP Debug 扩展。打开扩展面板(通过侧边栏的方块图标或者快捷键 `Ctrl+Shift+X`),搜索并安装 "PHP Debug" 扩展。 3. 在 VS Code 中创建一个调试配置文件 `launch.json`。点击 VS Code 左侧的调试图标(虫子图标),然后点击配置齿轮图标以打开 `launch.json` 文件。 4. 在 `launch.json` 文件中,选择 "PHP" 作为环境,并添加一个配置参数,如下所示: ```json { "version": "0.2.0", "configurations": [ { "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9000, "log": true, "pathMappings": { "/path/to/your/project": "${workspaceFolder}" } } ] } ``` 请将 `/path/to/your/project` 替换为您实际的项目路径。 5. 启动 Xdebug 会话。在 VS Code 中点击调试面板左上角的绿色播放按钮,选择 "Listen for Xdebug" 配置。这将启动 Xdebug 的监听模式。 6. 设置断点。在您的代码中选择要设置断点的行,然后运行您的应用程序。当代码执行到断点时,调试器将会暂停执行并允许您逐步调试。 希望以上步骤能帮助您成功下载并配置 Xdebug 进行调试。如有其他问题,请随时提问!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值