Friday, November 20, 2009

Zend_tool returns the same (older) version with xampp

I am new to Apache/PHP - Ran into this problem while reading my first tutorial on Zend - "Getting Started with Zend Framework" (html version) - thought I'd share this for anyone else out there searching for this

Zend version: V1.9.5 to D:\Zend\ and decided to try it out - following are the system specs:
OS: WindowsXP
Web server: XAMPP Win32-1.7.2 - PHP ver 5.3.0

Problem:
1. Executing "zf show version" showed me an older version

D:\Zend\bin>zf show version
Zend Framework Version: 1.9.0

2. Zend_Tool starting throwing problems when setting up the Controller:

D:\xampp\htdocs\zf\zf-tutorial>zf create action add index

An Error Has Occurred
A project profile was not found.

Zend Framework Command Line Console Tool v1.9.0
Details for action "Create" and provider "Action"
Action
zf create action name controller-name[=index] view-included[=1] module

Diagnosis:

Opened http://localhost/xampp/ and saw the include_path variable (set in php.ini) shows:

.;D:\installers\xampp-win32-1.7.2\xampp\php\PEAR

Turns out that XAMPP installs Zend as well (at D:\xampp\php\PEAR\Zend) - I had ver 1.9.0

This issue really is a bug in the framework and has been fixed: "zf create controller fails on Windows with ZF 1.9"

Resolution:
Make sure the path contains the folders containing zf.bat and php.exe

PATH
=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\xampp\php;D:\xampp\php\PEAR\Zend

Note: Putting D:\xampp\php in PATH so that php.exe can be found by zf.bat
Putting D:\xampp\php\PEAR\Zend in PATH so that zf.bat can be executed from anywhere

1. Remove the Zend\ folder and replace with the newly downloaded Zend distro (not necessary but good housekeeping)
2. Open php.ini and REPLACE the older include_path path with:
include_path = ".;D:\xampp\php\PEAR\Zend\library"
3. Restart Apache!

Note: Appending to the existing path threw another long error:


***************************** ZF ERROR *******************************
In order to run the zf command, you need to ensure that Zend Framework
is inside your include_path. If you are running this tool without


4. Finally, launch a new console, make sure ENV vars are set correctly, open phpinfo() link in xampp and make sure the include_path is correct and execute:

D:\xampp\htdocs>zf show version

Zend Framework Version: 1.9.5

D:\xampp\htdocs\zf\zf-tutorial>zf create action add index

Creating an action named add inside controller at D:\installers\xampp-win32-1.7.
2\xampp\htdocs\zf\zf-tutorial/application/controllers/IndexController.php
Updating project profile 'D:\xampp\htdocs\zf\zf-tut
orial/.zfproject.xml'
Creating a view script for the add action method at D:\installers\xampp-win32-1.
7.2\xampp\htdocs\zf\zf-tutorial/application/views/scripts/index/add.phtml
Updating project profile 'D:\xampp\htdocs\zf\zf-tut
orial/.zfproject.xml'

and it works!!!! :) - beautiful


Postscript:
I am not sure if replacing the include_path like this breaks anything w.r.t the other PEAR packages...

No comments:

Followers