Linux下用Xdebug調試php

來源:互聯網
上載者:User

標籤:copy   var   with   arp   enable   接下來   資訊   注釋   out   

Linux下用Xdebug調試php部落格分類: phpPHPLinuxZendEclipseC# 為了調試PHP程式,安裝一下xdebug.官方網址: http://www.xdebug.org首先下載xdebug2.1.0,在官方首頁下載原始碼,下載回來的檔案名稱是:xdebug-2.1.0.tgzxdebug的版本需與您的php版本相對應,由於偶的php是5.3.2,所以下載xdebug2.1.0  Xml代碼  收藏代碼cd /your/download/path  tar zxvf xdebug-2.1.0.tgz  cd xdebug-2.1.0   運行phpizeXml代碼  收藏代碼phpize        如果沒有將phpize加入$PATH,則應該使用全路徑這裡不需要--prefix,編譯好之後直接把modules裡的xdebug.so檔案複製走即可。Xml代碼  收藏代碼./configure --enable-xdebug   --with-php-config=/usr/local/php/bin/php-config    Xml代碼  收藏代碼make    把xdebug.so複製到了php安裝目錄,裝php的時候指定了安裝目錄,所以複製到/usr/local/php/xdebug裡。隨便你複製到哪都行,只要你清楚知道。。。需要改下面一條命令的路徑為你自己的。Xml代碼  收藏代碼cp modules/xdebug.so /usr/local/php/xdebug   把下面這行添加到php.ini檔案的最後。如果您定義過php.ini的存放位置,一定要找到位置哦,建議弄個phpinfo(),查看到php.ini檔案的具體位置。我的位置是在:/usr/local/etc/php.ini 添加下面內容:Xml代碼  收藏代碼[Xdebug]  zend_extension ="/usr/local/php5/xdebug/xdebug.so"  xdebug.profiler_enable=on   xdebug.trace_output_dir="/usr/local/php5/xdebug/"  xdebug.profiler_output_dir="/usr/local/php5/xdebug/"  xdebug.remote_enable=on             xdebug.remote_handler=dbgp            ;xdebug.remote_host=localhost  xdebug.remote_port=9999     注意,如果您安裝過zend optimizer 那麼,注意您的php.ini檔案中是否已存在zend_extension= ,如果已經存在,請注釋掉,在zend_extension=前加上; ,樣本:;zend_extension="/usr/local/lib/php/20060613/ZendExtensionManager.so"這樣,才可以正常安裝運行好xdebug.重啟你的web伺服器。接下來開啟phpinfo(),看看裡面是否有xdebug的資訊了。This program makes use of the Zend Scripting Language Engine:Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies     with Xdebug v2.0.2, Copyright (c) 2002-2007, by Derick Rethans可能遇到的問題 1.Cannot find autoconf/usr/local/php/bin/phpize提示Xml代碼  收藏代碼Configuring for:  PHP Api Version:         20041225  Zend Module Api No:      20060613  Zend Extension Api No:   220060519  Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF  environment variable is set correctly and then rerun this script.   原始碼目錄下也沒有產生configure需安裝兩個軟體包Xml代碼  收藏代碼imake-1.0.2-3.i386.rpm  autoconf-2.59-12.noarch.rpm   2.configure: error: Cannot find php-configXml代碼  收藏代碼./configure --with-php-config=/usr/local/php/bin/php-config    # 這裡如果直接執行./configure很有可能會報錯# "configure: error: Cannot find php-config. Please use --with-php-config=PATH",# 你的設定檔位置可能不在這個目錄,這個檔案通常是在php安裝目錄的bin目錄下的一個檔案名稱叫做php-config或者php-config5的檔案,實在找不到就find一下咯

  

Linux下用Xdebug調試php

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.