|
Tuesday, 01 March 2011 10:46 |
|
I have the following items previously configured:
- Macports install of PHP 5.2, MySQL, and Apache under /opt/local
- Zend Studio 8 with default workspace at /Users/stacey/Zend/workspaces/DefaultWorkspace7
- Zend Debugger installed (64-bit version)
- Running my Macbook in 64-bit mode
For a training class I am taking, I wanted to download and install the Zend Framework and create a new project.
You can also, of course, use Zend Studio to create a new Zend Framework project. This exercise is to understand how the Zend_Tool works, even without Zend Studio.
Here are the steps I needed to take to do so and also use my previously installed stack (rather than downloading Zend Server).
- Download the latest version of Zend Framework from http://www.zend.com/community/downloads. I downloaded Zend Framework 1.11 full
- Extract the downloaded file.
- Move the contents of the library directory to your php include path. With my Macports install, this location is /opt/local/lib/php
- Move the contents of the bin directory to your executable path. For me this is /opt/local/bin
- Create a symbolic link to the Zend Framework command line script (zf.sh)
ln -s /opt/local/bin/zf.sh /opt/local/bin/zf
- Test it out by typing the command below. You should see a listing of options for the zf command.
zf --help
- You can configure the storage path for the Zend_Tool. By default, it will create it in your $HOME directory, i.e. /Users/stacey. I wanted to change this to store it with my Zend Studio files. To do so, you need to add an environment variable like so:
export ZF_HOME=/Users/stacey/Zend/workspaces/DefaultWorkspace7
- Next type the following:
zf --setup storage-directory
zf --setup config-file
zf --info
- The last command (zf --info) shows the current setup for the Zend_Tool. My results:
shell$> zf --info
Zend_Tool & CLI Setup Information (available via the command line "zf --info") * Home directory found in environment variable ZF_HOME with value /Users/stacey/Zend/workspaces/DefaultWorkspace7 * Storage directory assumed in home directory at location /Users/stacey/Zend/workspaces/DefaultWorkspace7/.zf/ * Config file assumed in home directory at location /Users/stacey/Zend/workspaces/DefaultWorkspace7/.zf.ini To change the setup of this tool, run: "zf --setup"
- Note: I also initially got the following warning:
Failed loading opt/local/apache2/modules/ZendDebugger.so: (null)
To fix this, I first verified that I had the right version of Zend Debugger installed (64-bit for me). This was fine and I verified it was loading by looking at phpinfo(). To get rid of this error, I needed to edit the zf.sh file. You will need a tool like TextWrangler to be able to save your changes. Modify this line:
"$PHP_BIN" -d safe_mode=Off -f "$PHP_DIR/zf.php" -- "$@"
to
"$PHP_BIN" -n -d safe_mode=Off -f "$PHP_DIR/zf.php" -- "$@"
Save and restart Apache.
- Next try creating a project.
zf create project HelloWorld
You should now see a HelloWorld directory in your Storage directory (for me this is /Users/stacey/Zend/workspaces/DefaultWorkspace7/).
|