如何使用ZFTool创建较旧的(2.4不是2.5)ZF2项目

时间:2016-03-01 16:42:58

标签: zend-framework zftool2

在当前文件夹中我安装了ZFTool

$ cat composer.json
{
    "require" : {
        "php" : ">=5.3.3",
        "zendframework/zftool": "v0.1.0",
        "zendframework/zendframework": "2.4.8"
    }
}

$ /opt/lampp/bin/php ./vendor/bin/zf.php version
ZFTool - Zend Framework 2 command line Tool
The application in this folder is using Zend Framework 2.4.8

我试试

首先安装ZF2以后再创建项目

$ /opt/lampp/bin/php ./vendor/bin/zf.php install zf proj000 2.4.8
The ZF library 2.4.8 has been installed in proj000.

$ /opt/lampp/bin/php ./vendor/bin/zf.php create project proj000
The directory proj000 already exists. You cannot create a ZF2 project here.

我得到了正确的库版本但无法创建项目。

首先创建项目,然后安装ZF2

$ /opt/lampp/bin/php ./vendor/bin/zf.php create project proj001
sh: 1: php: not found
PHP Warning:  copy(/tmp/composer.phar): failed to open stream: No such file or directory in /PATH/vendor/zendframework/zftool/src/ZFTool/Controller/CreateController.php on line 85

Warning: copy(/tmp/composer.phar): failed to open stream: No such file or directory in /PATH/vendor/zendframework/zftool/src/ZFTool/Controller/CreateController.php on line 85
PHP Warning:  chmod(): No such file or directory in /PATH/vendor/zendframework/zftool/src/ZFTool/Controller/CreateController.php on line 87

Warning: chmod(): No such file or directory in /PATH/vendor/zendframework/zftool/src/ZFTool/Controller/CreateController.php on line 87
ZF2 skeleton application installed in proj001.
In order to execute the skeleton application you need to install the ZF2 library.
Execute: "composer.phar install" in proj001
For more info in proj001/README.md

$ /opt/lampp/bin/php ./vendor/bin/zf.php install zf proj001 2.4.8
The directory proj001 already exists. You cannot install the ZF2 library here.

当我查看proj001 / composer.json时,我看到,生成了ZF 2.5设置

{
    "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"
    }
}

ZFTool创建了一个项目,其中composer.json适用于ZF 2.5而不是ZF 2.4。 我无法使用它,因为我使用PHP 5.4托管服务器

1 个答案:

答案 0 :(得分:0)

我带来了以下解决方案。 我将生成的proj001 / composer.json更改为2.4设置

php composer.phar install

现在,zendframework/zendframework (2.4.9)安装较早的软件包,例如sudo mongo