mac系统下用zend framework 自动创建目录结构

折腾了一下午,终于解决了。

zend studio 似乎无法使用 "lauch with zend application deployment"创建项目。

 

 

解决办法:使用 zend framework命令行工具 

1. 最简单的方法是安装Zend Server。Zend Server 已经有 Mac OSX,Windows,Fedora Core,和 Ubuntu 版本的安装程序,以及一个适用于绝大多数 Linux 的安装包。安装 Zend Server 以后,可以在 Mac OSX 和 Linux 下的 /usr/local/zend/share/ZendFramework,在 Windows 下 C:/Program Files/Zend/ZendServer/share/ZendFramework 找到 Zend Framework 文件 。include_path 路径已经被配置成包括了 Zend Framework 。

2. 如果不打算安装 Zend Server,可以仅仅下载ZendFramework安装包,然后解压缩。记住文件解压缩后所在位置。

   官方原广文:http://framework.zend.com/manual/en/zend.tool.framework.clitool.html


在当前环境中加入zend 库

 

把下载后的 Zend Framework 文件夹下的 library/ 子目录添加到 php.ini 的 include_path 路径中。比如解压缩以后,Zend Framework 放置在 C:/program files/ (Mac:/private/etc/php.ini)下,打开 php.ini,找到 include_path 这一行,如果前面有注释符,把注释符去掉,然后整句修改为:

include_path = ".;C:/program files/Zend Framework/library"


安装命令行脚本

 

复制zend frameworks下的bin目录中的zf.sh和zf.php到php的bin目录

 

The most common setup in the *nix environment, is to copy the zf.sh and zf.php into the same directory as your PHP binary. This can generally be found in one of the following places:

  1. /usr/bin
  2. /usr/local/bin
  3. /usr/local/ZendServer/bin/
  4. /Applications/ZendServer/bin/

To find out the location of your PHP binary, you can execute 'which php' on the command line. This will return the location of the PHP binary you will be using to run PHP scripts in this environment.

如当前php的bin文件在/usr/bin/下,那么 

cp zf.sh /usr/bin/

cp zf.php /usr/bin 

 

加入bash命令:

在 /private/etc/ 目录下有一个 bashrc 文件,执行: 

sudo vi bashrc

编辑文件,添加: 

alias  zf=/usr/local/bin/zf.sh

保存,退出,重开终端,运行zf命令即可 

 

这时按理可以执行zf create project命令来创建工程了,但是结果报错:

$ zf create project quickstart
dyld: lazy symbol binding failed: Symbol not found: _xsltInitGlobals
Referenced from: /usr/lib/libexslt.0.dylib
Expected in: /usr/local/zend/lib/libxslt.1.dylib
dyld: Symbol not found: _xsltInitGlobals
Referenced from: /usr/lib/libexslt.0.dylib
Expected in: /usr/local/zend/lib/libxslt.1.dylib

解决办法

sudo cp /usr/local/zend/lib/libxslt.1.dylib /usr/local/zend/lib/libxslt.1.dylib.back
sudo cp /usr/lib/libexslt.0.dylib /usr/local/zend/lib/libxslt.1.dylib


工程创建成功,不过仍然有警告

$ zf create project quickstart
dyld: warning, DYLD_ setting caused circular dependency in /usr/local/zend/lib/libxslt.1.dylib
Failed loading /usr/local/zend/lib/ZendExtensionManager.so:  dlopen(/usr/local/zend/lib/ZendExtensionManager.so, 9): Symbol not found: _xsltApplyStylesheet
Referenced from: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
Expected in: /usr/local/zend/lib/libxslt.1.dylib
in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
Creating project at /Users/luowei/Sites/quickstart
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.

这样,在quickstart里就生成了基本的项目结构

 

 

 这样创建的项目在zend studio里通过import命令提示No projects are found to import,

还是得通过new命令的方式导入。 

 

posted @ 2012-08-18 17:24  weiwei~  阅读(1156)  评论(0编辑  收藏  举报