2014-05-08 85 views
0

我想在Ubuntu上安裝zend框架,我按照安裝說明從 http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html 鏈接但未能安裝。如何在Ubuntu上安裝zend框架?

我從這裏 https://github.com/zendframework/ZendSkeletonApplication

下載ZendSkeletonApplication此命令

php composer.phar self-update // it's working 

的該運行後,但在第一個命令之後的第二個命令

php composer.phar install // Not working 

,並顯示此錯誤

Loading composer repositories with package information 
Installing dependencies (including require-dev) 
Your requirements could not be resolved to an installable set of packages. 

Problem 1 
- zendframework/zendframework 2.3.1 requires php >=5.3.23 -> no matching package found. 
- zendframework/zendframework 2.3.0 requires php >=5.3.23 -> no matching package found. 
- Installation request for zendframework/zendframework 2.3.* -> satisfiable by zendframework/zendframework[2.3.0, 2.3.1]. 

Potential causes: 
- A typo in the package name 
- The package is not available in a stable-enough version according to your minimum-stability setting 
    see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. 

更新一些意見後:

現在我已經下載了ZendSkeletonApplication主,並在

移動的ZendFramework-2.3.1

庫文件夾

ZendSkeletonApplication-maste R /供應商/ ZF2/

但在那之後,當我訪問此我得到的頁面上此錯誤

ZendSkeletonApplication主/公/ index.php文件//在瀏覽器中顯示它我這個錯誤

Fatal error: Declaration of Zend\Stdlib\ArrayObject::offsetGet() must be compatible with 
that of ArrayAccess::offsetGet() in /var/www/html/demo/username/ZendSkeletonApplication 
-master/vendor/ZF2/library/Zend/Stdlib/ArrayObject.php on line 22 
+1

問題很明顯:ZF2需要PHP版本5.3.23或更高版本,它應該安裝在您的系統上。 php -v命令的輸出是什麼? – edigu

+0

php-v的輸出是: - 帶Suhosin-Patch(cli)的PHP 5.3.10-1ubuntu3.11(內置:2014年4月4日01:27:23) Copyright(c)1997-2012 PHP Group Zend Engine v2.3.0,Copyright(c)1998-2012 Zend Technologies – user3611956

+0

@ user3611956那麼,你學到了什麼? – Cully

回答

1

好兩種解決方案:

首先升級PHP的,但它可能是可能的,沒有對PHP升級你的系統上的Ubuntu發行版。所以在這種情況下,搜索谷歌爲您的ubuntu-VERSION添加php 5.3.23的APT存儲庫。

其次,我親身經歷的是,結賬文件夾中,你會發現composer.json文件,在該文件中,你將獲得的設置類似

"require": { 
    "php": ">=5.3.23", 
    "zendframework/zendframework": "2.3.*" 
} 

只需更改設置,以獲得其他版本ZF2的

"require": { 
    "php": ">=5.3.3", 
    "zendframework/zendframework": "2.2.*" 
} 

它適合我。它應該適合你。

+0

對不起,但不適合我.. – user3611956

+0

@ user3611956依靠'「zendframework/zendframework」:「2.2。*」'會工作。這是他職位的重點。如果沒有,將會有不同的錯誤信息。 – Sam

+0

@Sam,我想他現在改變了整個問題。 –

0

讀取錯誤,我們需要關注的主要事情是這樣的: zendframework/zendframework 2.3.1需要PHP> = 5.3.23 - >沒有找到匹配的包。

我會爲你分解它。

這說明你正試圖安裝(zendframework/zendframework 2.3.1)軟件包需要一個PHP版本大於或等於 5.3.23。正如您的php -v輸出所述,您正在運行PHP 5.3.10。如果您正在本地服務器上運行,您有權訪問更新php版本,然後更新php並再次運行它,您應該看到它工作正常。如果你在遠程服務器上,請聯繫你的託管公司,看看他們是否可以升級到更新版本的PHP,然後再運行它!

希望這會有所幫助!

+0

好吧,但我已經在/ usr/lib/php5中安裝php5 – user3611956

0

如果你安裝了多個版本的php,並且你有php環境變量鏈接到一個老的php可執行文件,那麼你可能會遇到這個問題。將您的環境變量更改爲您要使用的php。