简体   繁体   English

Zend命令行工具操作错误

[英]Zend command line tool action error

I just managed to create a project using Zend_Tool, but I am stuck on "second step" - enabling layout. 我只是设法使用Zend_Tool创建一个项目,但我坚持“第二步” - 启用布局。

zf enable layout

leads to: 导致:

An Error Has Occurred 发生了错误
Action 'enable' is not a valid action. 操作“启用”不是有效操作。

This is my folder structure: 这是我的文件夹结构:

|--library
|  |--Zend         //framework classes in this folder
|
|--bin             //command line tool folder
|  --zf.sh
|  --zf.php
|  --zf.exe
|
|--zend_test       //my test project folder
|  |--application
|  |--library
|  |  --Zend       //symlink to ../../library/Zend
|  |--public
|  |--tests

The library folder is in my include_path. 库文件夹位于我的include_path中。 Checked with: 检查:

php -i | grep include_path

Note that I was able to create the project with zf create project zend_test and other actions like show work. 请注意,我能够使用zf create project zend_testshow work等其他操作zf create project zend_test

There are some ppl on the official Zend Framework forum with same problem, but there are no answers. 官方的Zend Framework论坛上有一些问题存在同样的问题,但没有答案。

Thanks for any help. 谢谢你的帮助。

I solved the problem. 我解决了这个问题。

It was coincidence, what led to this error. 这是巧合,是什么导致了这个错误。 At first I was unable to even run the tool because I couldn't set include_path (because of permissions). 起初我甚至无法运行该工具,因为我无法设置include_path (因为权限)。 After that there was a problem with (most likely) out-of-date php. 之后有一个问题(很可能)是过时的PHP。 (original question is here ) (原始问题在这里

After few hours of headache I deleted the tool and left ZF for a while. 经过几个小时的头痛我删除了工具并离开了ZF一段时间。 Two days ago I wanted to try that on updated server, but coulnd't find the tool so I downloaded it again. 两天前我想在更新的服务器上尝试,但是找不到工具,所以我再次下载它。 Unfortunatelly (for me) Zend released new version of framework and I extracted only the tool. 不幸的是(对我来说)Zend发布了新版本的框架,我只提取了工具。

Briefly 简要地
There was a mismatch in versions of the tool ( bin ) and the framework ( library ) or possibly the library folder was corrupted. 工具( bin )和框架( library )的版本不匹配,或者library文件夹可能已损坏。

Solution
Download and extract the whole ZF again to make sure the versions match and files are not corrupted. 再次下载并解压缩整个ZF,以确保版本匹配且文件未损坏。 Also double check the include_path with php -i | grep include_path 还要用php -i | grep include_path仔细检查include_path php -i | grep include_path

I've download zf.bat from 我从中下载zf.bat

http://framework.zend.com/svn/framework/standard/trunk/bin/ http://framework.zend.com/svn/framework/standard/trunk/bin/

Revision 21133 修订版21133

This is the latest version, as my zend server... why can't I run commands such as: 这是最新版本,作为我的zend服务器...为什么我不能运行如下命令:

zf enable layout zf启用布局

zf configure db-adapter zf配置db-adapter

Heey, Heey,

I got exatly the same problem with XAMP. 我对XAMP的问题很简单。

It seems that Frankie-T's idea is good, because I renamed c:\\xampp\\php\\PEAR\\Zend to Zend_ and also c:\\xampp\\php\\zf.bat and c:\\xampp\\php\\zf.php to zf.bat_ zf.php_ . 似乎Frankie-T的想法很好,因为我将c:\\xampp\\php\\PEAR\\Zend to Zend_重命名c:\\xampp\\php\\PEAR\\Zend to Zend_并将c:\\xampp\\php\\zf.batc:\\xampp\\php\\zf.phpzf.bat_ zf.php_

Of course I have my ZF library downloaded to c:\\xampp\\htdocs\\zf\\ and my Path set to C:\\xampp\\htdocs\\zf\\bin; 当然我将我的ZF库下载到c:\\xampp\\htdocs\\zf\\并且我的Path设置为C:\\xampp\\htdocs\\zf\\bin;

Now if I run the folloving command, I get this: 现在如果我运行folloving命令,我得到这个:

C:\xampp\htdocs\login>zf show version
Zend Framework Version: 1.10.5

Now I have zf enable layout as well. 现在我也有zf enable layout

Hope this helps. 希望这可以帮助。

Zend also comes with XAMPP package. Zend还附带XAMPP包。 So, it is generally becoming a version mismatch. 因此,它通常会变成版本不匹配。 XAMPP's Zend version may be older. XAMPP的Zend版本可能更旧。 So, just rename or delete the Zend folder in \\xampp\\php\\PEAR. 因此,只需重命名或删除\\ xampp \\ php \\ PEAR中的Zend文件夹。 and it will start working. 它会开始工作。

http://www.satya-weblog.com/2010/11/zend-framework-creating-layout.html http://www.satya-weblog.com/2010/11/zend-framework-creating-layout.html

I got the same problem with a xampp 1.7.3 setup. 我在xampp 1.7.3设置中遇到了同样的问题。 I downloaded the whole Framework again, checked the entries in PATH. 我再次下载了整个Framework,检查了PATH中的条目。 The problem stayed the same. 问题保持不变。

Another Stack Overflow question brought the solution for me, as I encountered another strange behavior of a version mismatch when typing "zf show version". 另一个Stack Overflow问题为我带来了解决方案,因为我在键入“zf show version”时遇到了版本不匹配的另一个奇怪行为。

The problem comes with the xampp installation - it ships with an older version of zend. 问题来自xampp安装 - 它附带了旧版本的zend。

You need to override the files in XAMPP/php/PEAR/zend with the ones from the new library you just downloaded. 您需要使用刚刚下载的新库中的文件覆盖XAMPP / php / PEAR / zend中的文件。

Hope this helps. 希望这可以帮助。

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

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