【问题标题】:zend framework zf command not workingzend 框架 zf 命令不起作用
【发布时间】:2012-01-28 12:36:01
【问题描述】:

m 使用 wamp 和 zend 框架。首先,我安装了 wamp localhost,然后工作正常。 下载 Zend 框架。 windows环境变量中添加php路径、zend库路径。 启用重写模块并在 php.ini 中设置包含路径 我在 phpinfo 文件中得到了正确的结果。 在这之后我试图执行

zf create project FirstProject

在控制台上执行此命令后出现错误

In order to run the zf command, you need to ensure that Zend Framework
is inside your include_path.  There are a variety of ways that you can
ensure that this zf command line tool knows where the Zend Framework
library is on your system, but not all of them can be described here.

The easiest way to get the zf command running is to give it the include
path via an environment variable ZEND_TOOL_INCLUDE_PATH or
ZEND_TOOL_INCLUDE_PATH_PREPEND with the proper include path to use,
then run the command "zf --setup".  This command is designed to create
a storage location for your user, as well as create the zf.ini file
that the zf command will consult in order to run properly on your
system.

To change the setup of this tool, run: "zf --setup"

提前感谢您的帮助。

【问题讨论】:

    标签: zend-framework wamp


    【解决方案1】:

    我知道你说你已经添加了 php 和库路径,但如果你能再次确保你的环境变量被正确设置,那就太好了。

    注意:它是 zend 工具正常工作所需的 bin 目录。

    如果在此之后仍然无法工作,请告诉我,我们可以从那里开始。

    变量名:应该设置为

    Path
    

    而变量值:应该包含类似的链接

    C:\Zend\ZendServer\share\ZendFramework\bin;
    

    您的链接可能会有所不同,因为我将 Zend Server 安装在与默认位置不同的位置,并且该框架可通过“共享”目录获得。

    确保您放在那里的链接指向 zf.bat(在 Windows 系统上 - 我相信您使用的是 WAMP)所在的目录,并且您应该能够使用命令提示符测试它是否正常工作只是 zf 命令。

    进入可以更新环境变量的 GUI:

    1) Right click on the Computer icon on your Desktop and choose Properties option.
    2) In the System window click on Advanced system settings in the left pane
    3) In the System Properties window select Advanced tab and click on Environment Variables
    4) In the Environment Variables window you will notice two columns - User variables for a username and System variables
    5) In the System variables section scroll down to 'Path' and then highlight it and click 'Edit'
    6) At the end of the last entry place a ; character and then paste the path to the ZendFramework\bin on your system like above
    

    希望这会有所帮助,

    戴夫

    【讨论】:

    • 只有一个问题,我没有 Zend Server。我只有 Zend Framework,并且在环境变量中添加了 zf.bat 文件路径,但它仍然给出错误。我之前已经安装了 Zend Server,但后来删除了它是否需要安装 Zend Server?因为 m 按照 Zend Framework 初学者指南的说明,他们只要求使用 zend 框架
    • 在命令行中输入:php --ini 并确保您一直在为 CLI 编辑正确的 php.ini,有时有两个。还要确保在进行更改后重新启动 apache 和 php。在 Windows 中,通常最容易注销然后登录。
    • 是的,当我运行包含 phpinfo() 函数的 test.php 文件时编辑正确的 php.ini 包含路径包含 zend 库路径但仍然得到相同的错误 zf 命令未定义
    • 您好 Rohan,只是说您不需要 Zend Server 来使用 Zend_Tool(ZF 命令行工具)。如果您将在环境变量中设置的确切路径粘贴到我的评论中,这将有助于我帮助您。确保打开环境变量窗口,然后直接复制并粘贴,而不是手动输入。谢谢,Dave :-D
    • 您好,这是我的环境变量路径 %CommonProgramFiles%\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell \v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;;C:\Program Files\Dell\DW WLAN Card;C:\Program Files ( x86)\Zend\MySQL51\bin;C:\ZendFramework\bin;C:\wamp\bin\php\php5.3.8
    【解决方案2】:

    您收到此消息的事实意味着它可以很好地在 bin 中找到 zf 工具。它没有找到您的 zend 库文件的位置。您必须仅将 /Zend 文件夹从解压缩目录中的 /library/Zend 复制到某个位置。首选的方法是将 /Zend 文件夹直接复制到您的 php/includes 文件夹中,这样甚至不必在 php.ini 的 include_path 参数中添加任何内容,或者您​​至少必须取消注释它。所以在你移动之后,目录看起来像 /php/includes/Zend 并且 include_path 将是 'c:\php\includes'

    【讨论】:

      【解决方案3】:

      “所以在你移动之后,目录看起来像 /php/includes/Zend 并且 include_path 将是 'c:\php\includes'”

      我不是 PHP 专业开发人员,但我在上面 Andy 给出的很好的解释中指出,您应该小心设置 include_path 仅使用 'c:\php\includes' 而不是 'c:\ php\includes\Zend' 正如我所想的那样,直到我测试从路径中取出'Zend' 才起作用......希望这很有用。干杯。

      【讨论】:

        【解决方案4】:

        试试这个简单的技巧:

        步骤 1: 在您的 Program Files 目录中创建一个文件夹并将其命名为 ZendFrameworkCli

        C:\Program Files\ZendFrameworkCli
        

        步骤 2: 从 Zend Framework 文件中复制 binlibrary 并粘贴到上述目录中。

        9 月 3 日: 设置进入系统设置环境变量的路径。 对于 PHP,它将是 C:\wamp\bin\php\php5.3.5; 并从客户端 C:\Program Files\ZendFrameworkCli\bin; 使用 Zend

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-11-17
          • 2015-03-23
          • 2016-02-25
          • 1970-01-01
          • 1970-01-01
          • 2013-08-10
          相关资源
          最近更新 更多