gpt4 book ai didi

php - 如何在 Nginx 上使用 Xdebug 和 Laravel,在 Mac 上使用 PHPStorm?

转载 作者:可可西里 更新时间:2023-11-01 13:19:03 26 4
gpt4 key购买 nike

有关如何使用 PHPStorm 设置 XDebug 的指南。

版本:

  • PHP 7.0
  • PHPStorm 2016.3.2
  • XDebug 2.5
  • OS X El Capitan 10.11.6

最佳答案

本指南仅适用于 PHP7、Mac El Capitan、PHPStorm 2016.3

  1. 安装 brew http://brew.sh/
  2. 安装 php7 brew install php70
  3. 安装nginx

    指南 - http://learnaholic.me/2012/10/10/installing-nginx-in-mac-os-x-mountain-lion/

    配置 - https://gist.github.com/kmaxat/c07795ab88677efb843686d075fafa9e

  4. brew install php70-xdebug

  5. 在 laravel 的 public 文件夹中创建 info.php 文件:

    信息.php:<?php phpinfo();

  6. 编辑文件 /usr/local/etc/php7.0/conf.d/ext-xdebug.ini

    zend_extension="/usr/local/opt/php70-xdebug/xdebug.so"
    xdebug.remote_enable = 1
    xdebug.remote_connect_back=1
    xdebug.remote_port = 9001
    xdebug.scream=0
    xdebug.show_local_vars=1
    xdebug.idekey=PHPSTORM

  7. 重启nginx sudo nginx -s reloadbrew services restart nginx

  8. 重启 php-fpm brew services restart php70

  9. 转到localhost/info.php,你应该可以看到xdebug。部分图片:

List item

  1. 设置您的 CLI 解释器。 PHPStorm -> 设置 -> 语言和框架 -> PHP

enter image description here

  1. 点击 CLI 解释器旁边的“...”。如果上述步骤正确完成,您应该能够看到:

enter image description here

  1. 设置服务器:运行 -> 编辑配置 -> ...(在服务器旁边)。

enter image description here

  1. 设置编辑配置运行 -> 编辑配置 -> + -> PHP Web 应用程序。选择创建的服务器,设置名称

enter image description here

  1. 在工具栏中选择已创建的服务器,然后单击“开始监听 PHP 调试连接”。

enter image description here

  1. 在public/index.php设置断点

enter image description here

  1. 在工具栏中单击“调试‘ServerName’”

关于php - 如何在 Nginx 上使用 Xdebug 和 Laravel,在 Mac 上使用 PHPStorm?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41976690/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com