Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pecl problem #9

Closed
jaceju opened this issue Mar 19, 2012 · 20 comments
Closed

pecl problem #9

jaceju opened this issue Mar 19, 2012 · 20 comments

Comments

@jaceju
Copy link
Contributor

jaceju commented Mar 19, 2012

在 phpbrew switch php-5.4.0 的環境下,用 pecl 安裝 xdebug 後,它會把系統原本的 xdebug.so 砍掉;但是如果切換到系統原生模式下再重新安裝 xdebug ,它又會把 phpbrew 已經編譯好的 php-5.4.0 裡的 xdebug.so 砍掉。

如果改成先把已經編譯好的 xdebug.so 備份到別的地方,然後在被砍掉之後,重新複製回來,這樣就可以並存。 (有用 zend_extension 載入)

然後查看系統與 phpbrew 的 pecl 執行檔的位置,發現是共用的。

~  phpbrew switch off

~  php -v            
PHP 5.3.8 with Suhosin-Patch (cli) (built: Nov 15 2011 15:33:15) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
    with Xdebug v2.2.0rc1, Copyright (c) 2002-2012, by Derick Rethans

~  which pecl        
/usr/local/Cellar/pear/bin/pecl

~  phpbrew switch php-5.4.0

~  php -v                  
PHP 5.4.0 (cli) (built: Mar  5 2012 10:44:22) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.0rc1, Copyright (c) 2002-2012, by Derick Rethans

~  which pecl              
/usr/local/Cellar/pear/bin/pecl

這是否是因為共用 pecl 的關係?還是有設定檔需要修改?

@c9s
Copy link
Member

c9s commented Mar 19, 2012

可以給我看一下 $PATH 嗎?

  echo $PATH 

@c9s
Copy link
Member

c9s commented Mar 19, 2012

應該是要這樣:

 $ which pecl 
 /Users/c9s/.phpbrew/php/php-5.4.0/bin/pecl

Off 之後:

 $ which pecl
 /opt/local/bin/pecl

@jaceju
Copy link
Contributor Author

jaceju commented Mar 19, 2012

我的 $PATH :

/Users/jaceju/.phpbrew/php/php-5.4.0/bin:/Users/jaceju/.bin:/usr/local/Cellar/pear/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/jaceju/.rvm/bin

@jaceju
Copy link
Contributor Author

jaceju commented Mar 19, 2012

補充,在 /Users/jaceju/.phpbrew/php/php-5.4.0/bin 底下沒有 pecl :

~  ls /Users/jaceju/.phpbrew/php/php-5.4.0/bin 
phar       phar.phar  php        php-cgi    php-config phpize

@c9s
Copy link
Member

c9s commented Mar 20, 2012

裝 php 的時候有 +pear 嗎 ?

@jaceju
Copy link
Contributor Author

jaceju commented Mar 20, 2012

有的,安裝指令如下:

phpbrew install --no-test php-5.4.0 +apxs2=/usr/sbin/apxs +pear +pdo +sqlite +mysql

@jaceju
Copy link
Contributor Author

jaceju commented Mar 20, 2012

用新版本的 phpbrew 重新安裝,結果如下:

php  phpbrew install --no-test php-5.4.0 +apxs2=/usr/sbin/apxs +pear +pdo +sqlite +mysql +openssl
===> Downloading http://www.php.net/distributions/php-5.4.0.tar.bz2
######################################################################## 100.0%
===> Extracting...
Build Dir: /Users/jaceju/.phpbrew/build/php-5.4.0
===> Cleaning...
Variant pear is not defined.

@c9s
Copy link
Member

c9s commented Mar 20, 2012

喔對了 pear 這個 variant 後來已經改為預設(一定要的了) 所以新版的 phpbrew 不加上 pdo 跟 pear 沒關係

@jaceju
Copy link
Contributor Author

jaceju commented Mar 20, 2012

瞭解,我重新安裝試試看,有問題再回報。

@jaceju
Copy link
Contributor Author

jaceju commented Mar 20, 2012

重新安裝後,問題還是一樣, phpbrew 並沒有在 ~/.phpbrew/php/php-5.4.0/bin 下安裝 pear 及 pecl ?還是我需要先 switch 過去後,再安裝一次 pear ?

@jaceju
Copy link
Contributor Author

jaceju commented Mar 20, 2012

我用以下的方法解決了:

~ wget http://pear.php.net/go-pear.phar
~ php go-pear.phar
Installation base: /Users/jaceju/.phpbrew/php/php-5.4.0

然後把原有的 pear 目錄連過來:

~ cd /Users/jaceju/.phpbrew/php/php-5.4.0/share
~ ln -s /usr/local/Cellar/pear/share/pear

暫時是這樣解。

@c9s
Copy link
Member

c9s commented Mar 20, 2012

這樣的話 /Users/jaceju/.phpbrew/php/php-5.4.0/bin 底下有 pecl 或 pear 嗎 ?

@c9s
Copy link
Member

c9s commented Mar 20, 2012

這個地方有點奇怪,因為我之前有一次好像也是沒有 pear, pecl 後來重裝卻又有了 XD

@jaceju
Copy link
Contributor Author

jaceju commented Mar 20, 2012

用 php go-pear.phar 裝的話,就會出現了,但之前重新安裝三次都是沒有 :(

@c9s
Copy link
Member

c9s commented Mar 20, 2012

真奇怪,找時間研究看看 @@

@c9s
Copy link
Member

c9s commented Mar 20, 2012

對了你裝的 log 檔可以貼上來看看嗎 ?

@jaceju
Copy link
Contributor Author

jaceju commented Mar 21, 2012

log 如下:

~ tail -f /Users/jaceju/.phpbrew/php/php-5.4.0/build.log

[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.1
[PEAR] PEAR           - installed: 1.9.4
Warning! a PEAR user config file already exists from a previous PEAR installation at '/Users/jaceju/.pearrc'. You may probably want to remove it.
Wrote PEAR system config file at: /Users/jaceju/.phpbrew/php/php-5.4.0/etc/pear.conf
You may want to add: /Users/jaceju/.phpbrew/php/php-5.4.0/lib/php to your php.ini include_path
/Users/jaceju/.phpbrew/build/php-5.4.0/build/shtool install -c ext/phar/phar.phar /Users/jaceju/.phpbrew/php/php-5.4.0/bin
ln -s -f /Users/jaceju/.phpbrew/php/php-5.4.0/bin/phar.phar /Users/jaceju/.phpbrew/php/php-5.4.0/bin/phar
Installing PDO headers:          /Users/jaceju/.phpbrew/php/php-5.4.0/include/php/ext/pdo/

@jaceju
Copy link
Contributor Author

jaceju commented Mar 21, 2012

我把 ~/.pearrc 移掉再重裝就可以了。但這樣就造成系統原先的 pear 會無法正確使用。

@c9s
Copy link
Member

c9s commented Mar 24, 2012

其實應該是要分開 library path 才對。

有可能是因為 .pearrc 的關係所以才沒裝上去?我需要測試一下

@c9s
Copy link
Member

c9s commented Aug 27, 2012

我後來測試發現,如果你已經用 go-pear 裝了 pear,那麼 php 在 build 的時候就不會另外幫你裝 pear 。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants