2011-01-27 97 views
1

我試圖在Linux機器上安裝Xdebug以進行PHP的遠程調試。我在嘗試構建它時碰到過很多問題,我似乎已經解決了一些問題,但現在我感覺停滯不前。簡短描述,「make」沒有成功完成,說它找不到zend_config.h或TSRM_config.h。不知道如何去得到這些。嘗試爲PHP構建Xdebug時缺少「Make」的頭文件

更深入的解釋:(注意我不是超級Linux的悟性,所以如果你看到的東西,我所做的就是公然錯了,請讓我知道)

我試圖跟隨我提供的指令here提供了我的phpinfo()詳細信息(請參閱文章結尾)。試圖「製造」當我最初得到了一些類似這樣的錯誤:

Error: ‘ZEND_USER_OPCODE_DISPATCH’ undeclared (first use in this function) 
Error: ‘ZEND_RAISE_ABSTRACT_ERROR’ undeclared (first use in this function) 
Etc. 

我的猜測是,它並沒有與Zend的正確版本phpize'd(如果我的措辭正確)。回到phpize步驟,返回的版本不能與phpinfo()對齊。而不是看到:

PHP Api Version:   whatever 
Zend Module Api No:   20060613 
Zend Extension Api No:  220060519 

我反而看到:

PHP Api Version:   20020918 
Zend Module Api No:   20020429 
Zend Extension Api No:  20050606 

爲了讓事情變得更加複雜,我運行XAMPP(1.6.8a)的舊版本,讓我到PHP 4.4之間切換.9和PHP 5.2.6(目前正試圖在我的工作上轉換PHP版本,並進行調試確實會加快速度)。我目前有PHP5模式運行。檢查/ opt/lampp/bin/phpize,我發現它是「phpize-5.2.6」的符號鏈接。我的猜測是,XAMPP只是切換鏈接,取決於它被告知啓動的PHP版本。無論如何,這部分看起來很好,我運行phpize-5.2.6進行了一次完整性檢查,仍然得到舊版本號。現在,php-config的設置類似,運行php-config --version返回「5.2.6」,這很好。

我做了一些更多的挖掘和穿越this post(線程中倒數第二)。我最終下載了5.2.17版的PHP源代碼(希望這足夠接近),並創建了線程中描述的軟鏈接。 Phpize版本現在看起來好多了,有什麼Xdebug的網站說,我應該看到排隊:

PHP Api Version:  20041225 
Zend Module Api No:  20060613 
Zend Extension Api No: 220060519 

「製作」現在拋出缺少頭文件上面列出的錯誤。我看到this post並決定玩我的配置文件。

我註釋掉

-no-create | --no-create | --no-creat | --no-crea | --no-cre \ <br/> 
    | --no-cr | --no-c | -n) 
    no_create=yes ;; 

並已刪除這一行-no創建:

set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion 

仍然沒有運氣。我認爲配置應該創建這些配置文件或東西?不知道接下來要嘗試什麼。如果有幫助,我正在運行SUSE SLES 10.謝謝。

Xdebug custom generated install instructions: 
SUMMARY 
• Xdebug installed: no 
• Server API: Apache 2.0 Handler 
• Windows: no 
• Zend Server: no 
• PHP Version: 5.2.6 
• Zend API nr: 220060519 
• PHP API nr: 20060613 
• Debug Build: no 
• Thread Safe Build: no 
• Configuration File Path: /opt/lampp/etc 
• Configuration File: /opt/lampp/etc/php.ini 
• Extensions directory: /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613 
INSTRUCTIONS 
1. Download xdebug-2.1.0.tgz 
2. Unpack the downloaded file with tar -xvzf xdebug-2.1.0.tgz 
3. Run: cd xdebug-2.1.0 
4. Run: phpize 
As part of its output it should show: 
Configuring for: 
... 
Zend Module Api No:  20060613 
Zend Extension Api No: 220060519 
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step. 
5. Run: ./configure 
6. Run: make 
7. Run: cp modules/xdebug.so /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613 
8. Edit /opt/lampp/etc/php.ini and add the line 
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so 
9. Restart the webserver 

回答

0

所以原來運行的配置,當我需要一個額外的標誌:

--enable-Xdebug的

很簡單,但我用的指令從來沒有提到這一點。在瀏覽Xdebug的討論列表存檔後才發現它。

請注意,儘管「make」似乎在第一次沒有錯誤時正常工作,但我仍然沒有在modules /中獲得xdebug.so文件。然後我做了一個「make clean」,再次運行phpize,配置然後make,這次我得到了這個文件。

0

看起來您使用的是舊版本的PHP,這可能意味着您正在使用您的Linux發行版中的PHP軟件包。

如果是這種情況,請首先檢查您的發行版是否提供xdebug軟件包。如果沒有,您可能需要安裝php * -dev或php * -devel包,才能構建模塊。

+0

做了一些更多的挖掘,並能夠在opensuse.org上爲我的舊版本的SUSE找到一個軟件包。儘管安裝Xdebug 2.1.0-5.1,但Yast表示它需要依賴PHP 5.2.5,這實際上比我已經更老。我可能會找到它的存儲庫,但我在這個盒子上安裝第三個PHP版本有點猶豫。我會試着抓住開發版本的源碼,看看會發生什麼。 – 2011-01-27 17:02:34