Heim >Backend-Entwicklung >PHP-Tutorial >详解Zend Debugger安装全过程_PHP教程
调试技术是我们编程中不可或缺的重要部分,调试器是每个IDE环境都必备的组件。既然如此,Zend Studio的集成环境拥有一个调试器也就是理所当然的事情了,但是,该调试器在配置使用起来,其显示出来的强劲功能一定会让你惊叹不已!
事实上,Zend Studio(后面简称ZDE)的调试功能分为内部调试和远程调试。内部调试是用ZDE内置的PHP(有4、5两个版本)进行的代码初步调试,我们把重点放在远程调试上,因为它可以完全模拟一个真实的运行环境。
远程调试需要服务器端的组件支持,我们今天的内容就是怎么来安装这个服务器端调试环境,用到的调试组件是Zend Debugger,它是轻便而且够用的,在撰写本文时,其最新版本是5.2.14,与网络上广为流传的5.2.10版略有更新。我的服务器是windows下的apache,因此我就下载了windows版的Zend Debugger,下来的压缩包大约2.1M,有个readme.txt,我觉得有必要看哈子:
<ol class="dp-xml"> <li class="alt"><span><span>Zend Debugger installation instructions </span></span></li> <li><span>————————————— </span></li> <li class="alt"><span>1. Locate ZendDebugger.so or ZendDebugger.dll file that is compiled for the correct version of PHP </span></li> <li><span>(4.3.x, 4.4.x, 5.0.x, 5.1.x, 5.2.x) in theappropriate directory. </span></li> <li class="alt"><span> </span></li> <li><span>2. Add the following line to the php.ini file: </span></li> <li class="alt"> <span>Linux and Mac OS X: </span><span class="attribute">zend_extension</span><span>=/full/path/to/ZendDebugger.so </span> </li> <li> <span>Windows: </span><span class="attribute">zend_extension_ts</span><span>=/full/path/to/ZendDebugger.dll </span> </li> <li class="alt"> <span>Windows non-tread safe: </span><span class="attribute">zend_extension</span><span>=/full/path/to/ZendDebugger.dll </span> </li> <li><span>(*) the windows non-thread safe is used only with Zend Core 2.0 </span></li> <li class="alt"><span> </span></li> <li><span>3. Add the following lines to the php.ini file: </span></li> <li class="alt"> <span class="attribute">zend_debugger.allow_hosts</span><span>=</span><span class="tag"><span class="tag-name">ip_addresses</span><span class="tag">></span><span> </span></span> </li> <li> <span class="attribute">zend_debugger.expose_remotely</span><span>=</span><span class="attribute-value">always</span><span> </span> </li> <li class="alt"><span> </span></li> <li><span>4. Place dummy.php file in the document root directory. </span></li> <li class="alt"><span> </span></li> <li><span>5. Restart web server. </span></li> <li> </li> </ol>
这里已经非常详细的讲了安装方法了,那我就以我晦涩的语言再描述一遍吧,以下是压缩包内所有文件的列表:
<ol class="dp-xml"> <li class="alt"><span><span>ZendDebugger-5.2.14RC9-cygwin_nt-i386md5 </span></span></li> <li><span>ZendDebugger-5.2.14RC9-cygwin_nt-i386Inventory.xml </span></li> <li class="alt"><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3864_3_x_comp </span></li> <li><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3864_3_x_compZendDebugger.dll </span></li> <li class="alt"><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3864_4_x_comp </span></li> <li><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3864_4_x_compZendDebugger.dll </span></li> <li class="alt"><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3865_0_x_comp </span></li> <li><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3865_0_x_compZendDebugger.dll </span></li> <li class="alt"><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3865_1_x_comp </span></li> <li><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3865_1_x_compZendDebugger.dll </span></li> <li class="alt"><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3865_2_x_comp </span></li> <li><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3865_2_x_compZendDebugger.dll </span></li> <li class="alt"><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3865_2_x_nts_comp </span></li> <li><span>ZendDebugger-5.2.14RC9-cygwin_nt-i3865_2_x_nts_compZendDebugger.dll </span></li> <li class="alt"><span>ZendDebugger-5.2.14RC9-cygwin_nt-i386dummy.php </span></li> <li><span>ZendDebugger-5.2.14RC9-cygwin_nt-i386README.txt </span></li> <li> </li> </ol>
解压出合适的也就是和你当前php的版本对应的Zend Debugger版本,我的php版本是5.2.5,因此我就把5_2_x_comp给拖出来了(至于5_2_x_nts_comp指的是non-tread safe,没有明白具体用途,也就不妄用了),我将5_2_x_compZendDebugger.dll移动到D:myserverZendDebugger5_2_xZendDebugger.dll,将压缩包中的dummy.php解压到web根目录,我这里的apache的DocumentRoot设置在D:/myserver/wwwroot,就拷贝dummy.php到D:myserverwwwroot,然后修改php.ini,加入了这些内容:
<ol class="dp-xml"> <li class="alt"><span><span class="attribute">zend_extension_ts</span><span>=</span><span class="attribute-value">D</span><span>:/myserver/ZendDebugger/5_2_x/ZendDebugger.dll </span></span></li> <li> <span class="attribute">zend_debugger.allow_hosts</span><span>=</span><span class="attribute-value">127</span><span>.0.0.1/32,192.168.1.88/24 </span> </li> <li class="alt"> <span class="attribute">zend_debugger.expose_remotely</span><span>=</span><span class="attribute-value">always</span> </li> <li class="alt"><span> </span></li> </ol>
然后重启apache,在略微的等待之后,我们输入phpinfo()查看成功与否?