我正在尝试使用NetBeans中的骨架创建Zend Framework应用程序。当我运行Composer安装时,收到以下错误消息:
"C:\php\php.exe" "C:\composer\composer.phar" "--ansi" "--no-interaction" "update" "--dev"
You are using the deprecated option "dev". Dev packages are installed by default now.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php >=5.5 but your PHP version (5.4.42) does not satisfy that requirement.
Problem 2
- Installation request for zendframework/zendframework 2.5.1 -> satisfiable by zendframework/zendframework[2.5.1].
- zendframework/zendframework 2.5.1 requires php >=5.5 -> your PHP version (5.4.42) does not satisfy that requirement.
Done.
显然,Zend Framework only needs PHP 5.3+与上述内容相矛盾。我需要使用PHP 5.4。
我的composer.json
如下:
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.5",
"zendframework/zendframework": "2.5.1"
}
}
如何使用骨架创建PHP 5.4 / ZendFramework 2应用程序?有解决方法吗?我是ZendFramework和作曲家的新手。
答案 0 :(得分:1)
您关联的网页已过期。 Zend Framework 2.5需要PHP 5.5或更高版本。您可以在PHP版本上运行ZF 2.4.x,但是PHP 5.4 reaches end of life in a couple of months,所以如果可以,最好安装更新版本的PHP。
答案 1 :(得分:0)
我引用您放在此处的代码段:
"php": ">=5.5",
删除该行,一切正常。
顺便说一下,永远不会在composer.json
文件中有锁定版本。运行composer.lock
时,锁定版本由Composer自动在composer update
内完成。相反,请使用^2.5.1
之类的版本约束(意为>=2.5.1,<3.0-dev)
或~2.5.1
(意为>=2.5.1,<2.6-dev
)。
答案 2 :(得分:0)
简单易用的解决方案: 安装Bitnami Lamp Stack它拥有您所需要的一切,包括完整的zendframework。
一旦你有Lamp Stack(linux)或Wamp Stack(windows),就转到位于类似/home/user/lampstack-5.6.29-1/apache2/conf/bitnami
之类的路径的config目录并编辑文件bitnami-apps-prefix.conf
,你会在那里找到一条注释行
#Include "/home/user/lampstack-5.6.29-1/frameworks/zendframework/conf/httpd-prefix.conf"
// uncomment it deleting the character "#"
// let it:
Include "/home/user/lampstack-5.6.29-1/frameworks/zendframework/conf/httpd-prefix.conf"
// save changes and exit.
如果服务器正在运行,请重新启动它。现在你有zend,php,apache和mysql运行。
问候