简体   繁体   English

如何在Ubuntu上安装zend框架?

[英]How to install zend framework on Ubuntu?

I want to install zend framework on the Ubuntu and i have followed the instruction of installation from http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html link but failed to install. 我想在Ubuntu上安装zend框架,我已经按照http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html链接中的安装说明进行了安装,但安装失败。

I have downloaded the ZendSkeletonApplication from here https://github.com/zendframework/ZendSkeletonApplication 我已经从这里https://github.com/zendframework/ZendSkeletonApplication下载了ZendSkeletonApplication。

After that run of this command 在运行该命令之后

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

But after the first command the second Command 但是在第一个命令之后,第二个命令

php composer.phar install   // Not working

And showing this error 并显示此错误

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.

Update after some comments: 评论后更新

Now I've downloaded the ZendSkeletonApplication-master and move the 现在,我已经下载了ZendSkeletonApplication-master并移动了

Library folder of ZendFramework-2.3.1 ZendFramework-2.3.1的库文件夹

in the 在里面

ZendSkeletonApplication-master/vendor/ZF2/ ZendSkeletonApplication主/供应商/ ZF2 /

But after that when i access this i'm getting this error on the page 但是之后,当我访问它时,我在页面上收到此错误

ZendSkeletonApplication-master/public/index.php // in the browser it showing me this error ZendSkeletonApplication-master / public / 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

Well two solutions are possible : 那么两种解决方案是可能的:

First upgrade php, However it could be possible that Ubuntu release on your system not having upgrades for php. 首先升级php,但是您系统上的Ubuntu版本可能没有php的升级。 So in that case search google to add APT repository for php 5.3.23 for your ubuntu-VERSION. 因此,在这种情况下,搜索google为您的ubuntu-VERSION添加php 5.3.23的APT存储库。

Second I personally experienced that, Checkout in folder you will found composer.json file, In that file you will get the settings something like 其次,我个人经历过,在Checkout文件夹中您将找到composer.json文件,在该文件中,您将获得类似于

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

Just change settings to get other version of ZF2 只需更改设置即可获取其他版本的ZF2

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

It works for me. 这个对我有用。 It should work for you. 它应该为您工作。

Read the error, the main thing we need to focus on is this: zendframework/zendframework 2.3.1 requires php >=5.3.23 -> no matching package found. 读取错误,我们需要重点关注的是:zendframework / zendframework 2.3.1需要php> = 5.3.23->找不到匹配的软件包。

I'll break it down for you. 我为您分解。

This states that the package you are attempting to install(zendframework/zendframework 2.3.1) REQUIRES a php version GREATER OR EQUAL TO 5.3.23. 这说明您尝试安装的软件包(zendframework / zendframework 2.3.1) 需要 php版本GREATER或EQUAL TO 5.3.23。 As your php -v output stated, you are running PHP 5.3.10. 如您的php -v输出所示,您正在运行PHP 5.3.10。 If you are running on a local server that you have access to updating the php version, then update php and run it again, you should see that it works fine. 如果您在有权更新php版本的本地服务器上运行,则更新php并再次运行它,您应该会看到它工作正常。 If you are on a remote server, contact your hosting company and see if they can upgrade you to a newer version of php and then run it again! 如果您在远程服务器上,请与您的托管公司联系,看看他们是否可以将您升级到新版本的php,然后再次运行它!

Hope this helps! 希望这可以帮助!

If you have more then one version of php installed and you have php environment variable linking to an old php executable then you may get this issue. 如果您安装了多个版本的php,并且您的php环境变量链接到旧的php可执行文件,则可能会遇到此问题。 Change your environment variable to the php you want to use. 将环境变量更改为要使用的php。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM