2014-05-08 201 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。