• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

mac+php+xdebug+phpstorm在苹果下配置xdebug几经周折

php 搞代码 4年前 (2022-01-24) 21次浏览 已收录 0个评论

mac+php+xdebug+phpstorm在苹果下配置xdebug一波三折

1.下载xdebug文件

http://xdebug.org/wizard.php

将phpinfo()的源代码复制到文本框中,xdebug会提示如何配置和下载哪个版本的xdebug。

全部下载地址:

http://www.xdebug.org/download.php

<span style="color: #000000">InstructionsDownload xdebug</span>-<span style="color: #800080">2.3</span>.<span style="color: #800080">3</span><span style="color: #000000">.tgzUnpack the downloaded </span><span style="color: #0000ff">file</span> with <span style="color: #0000ff">tar</span> -xvzf xdebug-<span style="color: #800080">2.3</span>.<span style="color: #800080">3</span><span style="color: #000000">.tgzRun: cd xdebug</span>-<span style="color: #800080">2.3</span>.<span style="color: #800080">3</span><span style="color: #000000">Run: phpize (See the FAQ </span><span style="color: #0000ff">if</span> you don<span style="color: #800000">'</span><span style="color: #800000">t have phpize.</span><span style="color: #000000">As part of its output it should show:Configuring </span><span style="color: #0000ff">for</span><span style="color: #000000">:...Zend Module Api No:      </span><span style="color: #800080">20121212</span><span style="color: #000000">Zend Extension Api No:   </span><span style="color: #800080">220121212</span><span style="color: #000000">If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.Run: .</span>/<span style="color: #000000">configureRun: </span><span style="color: #0000ff">make</span><span style="color: #000000">Run: </span><span style="color: #0000ff">cp</span> modules/xdebug.so /usr/lib/php/extensions/no-debug-non-zts-<span style="color: #800080">20121212</span><span style="color: #000000">Edit </span>/etc/<span style="color: #000000">php.ini and add the linezend_extension </span>= /usr/lib/php/extensions/no-debug-non-zts-<span style="color: #800080">20121212</span>/<span style="color: #000000">xdebug.soRestart the webserver</span>

在xdebug官网会有许多安装提示。其中可能会出现的问题有:

phpize没有安装:继而又要安装brew,再安装autoconf可谓一波三折

2.解决相关组件不全的问题

<span style="font-size: 14px">问题描述</span><br /><span style="font-size: 14px">Mac系统升级到10.9(mavericks)时安装php扩展,执行 phpize 提示如下错误:</span><br /><br /><span style="font-size: 14px">Cannot find autoconf. Please check your autoconf installation</span><br /><span style="font-size: 14px">and the $PHP_AUTOCONF environment variable.</span><br /><span style="font-size: 14px">解决办法</span><br /><span style="font-size: 14px">先安装Homebrew:<br /></span>如果以下链接失效的话,可以到brew官网查看。http://brew.sh/
<code id="selectable">ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</code>
<span style="font-size: 14px">然后安装 autoconf:</span><br /><br /><span style="font-size: 14px">brew install autoconf</span>

3.配置php.ini

在xdebug官网上的配置,只能够正确配置好xdebug但是不能与phpstorm进行配置。在php.ini末尾加上如下代码:

<span style="color: #000000">[xdebug]zend_extension</span>=<span style="color: #800000">"/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so</span><span style="color: #800000">"</span><span style="color: #000000">xdebug.remote_enable </span>=<span style="color: #000000"> Onxdebug.remote_handler </span>= <span style="color: #800000">"</span><span style="color: #800000">dbgp</span><span style="color: #800000">"</span><span style="color: #000000">xdebug.remote_host </span>= <span style="color: #800000">"</span><span style="color: #800000">localhost</span><span style="color: #800000">"</span><span style="color: #000000">xdebug.remote_port </span>= <span style="color: #800080">9000</span><span style="color: #000000">xdebug.idekey </span>= PHPSTROM

4.配置phpstorm

打开phpStorm,
-进入File>Settings>PHP>Servers,这里要填写服务器端的相关信息,name填localhost,host填localhost,port填80,debugger选XDebug
-进入File>Settings>PHP>Debug,看到XDebug选项卡,port填9000,其他默认
-进入File>Settings>PHP>Debug>DBGp Proxy,IDE key 填 phpStorm,host 填localh(、本文来源gao@!dai!ma.com搞$$代^@码网*搞gaodaima代码ost,port 填80
-点OK退出设置。

在phpStorm里打开监听(电话按钮)。

5.chrome的xdebug配置

在IDE key里将其配置成“phpStorm”

项目地址:https://github.com/mac-cain13/xdebug-helper-for-chrome

好了,到此就可以配置完成了,有问题的话可以给我留言,大家一起交流。

6.其他:

重启apache

sudo apachectl restart

修改php.ini权限

sudo chmod 0777 php.ini

编辑php.ini文件

sudo vi php.ini(修改i,退出:q,保存退出:wq)


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:mac+php+xdebug+phpstorm在苹果下配置xdebug几经周折

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址