当使用 composer 引导时,我不知道如何运行 zf.php(Zend Framework 2 工具).
I can't figure out how to run zf.php (Zend Framework 2 Tool) when bootstrapped with composer.
首先我根据文档引导 composer 和 zftool:
First I bootstrap composer and zftool according to the documentation:
$ mkdir tmp && cd tmp
$ curl -s https://getcomposer.org/installer | php
$ ./composer.phar require zendframework/zftool:dev-master
到目前为止,这工作正常.
This works fine so far.
但是当我尝试运行 zf.php 时,我得到了错误:
But when I try to run zf.php, I get errors:
$ vendor/zendframework/zftool/zf.php
PHP Warning: require_once(/Users/seb/tmp/vendor/zendframework/zftool/vendor/autoload.php): failed to open stream: No such file or directory in /Users/seb/tmp/vendor/zendframework/zftool/zf.php on line 13
Warning: require_once(/Users/seb/tmp/vendor/zendframework/zftool/vendor/autoload.php): failed to open stream: No such file or directory in /Users/seb/tmp/vendor/zendframework/zftool/zf.php on line 13
PHP Fatal error: require_once(): Failed opening required '/Users/seb/tmp/vendor/zendframework/zftool/vendor/autoload.php' (include_path='.:/opt/local/lib/php') in /Users/seb/tmp/vendor/zendframework/zftool/zf.php on line 13
Fatal error: require_once(): Failed opening required '/Users/seb/tmp/vendor/zendframework/zftool/vendor/autoload.php' (include_path='.:/opt/local/lib/php') in /Users/seb/tmp/vendor/zendframework/zftool/zf.php on line 13
我做错了什么?我在 Mac 上使用 PHP 5.3.21.
What am I doing wrong? I'm using PHP 5.3.21 on Mac.
我还在我的 Debian VServer 上使用 PHP 5.4 对其进行了测试,同样的错误:(
I also tested it on my Debian VServer with PHP 5.4, same error :(
你应该将 zf.php 复制到你的根目录并从那里运行它.
You should copy zf.php into your root directory and run it from there.
$ mkdir tmp && cd tmp
$ curl -s https://getcomposer.org/installer | php
$ ./composer.phar require zendframework/zftool:dev-master
$ cp vendor/zendframework/zftool/zf.php .
$ php zf.php
这篇关于如何使用 composer 安装 Zend Framework 2 Tool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!