Zend Framework on XAMPP?

Hello guys

can you show me a good tutorial, on how to properly setup Zend Framework under XAMPP.

Thank you veyy much in advance.

Unzip the the Zend archive to some location, probably in the directory of your application. Then include it…


<?php

require 'path/to/zend/loader.php';
Zend_Loader::registerAutoload();

Done…

@logic_earth thanks but this is my first time of using zend.

actually i already successfully installed XAMMP and it’s running very fine.
and i downloaded and extracted Zend Framework in the c:\zf directory.
i also edited the php.ini like this below,


include_path = ".;C:\\xampp\\php\\PEAR;c:\\zf\\library;c:\\zf\\bin"

i run the xampp and called this code below,


% zf create project quickstart

but unfortunately it doesn’t work.

Now my question is, is my include path is wrong?
Do i need to put the Zend Framework under XAMPP directory?

Where did i made wrong?

Thank you very much in advance.

You can put Zend Framework to any directory on your computer. Just add it to include path and it will work (by using set_include_path() or by editing the php.ini). You can use Zend_Loader to to load the classes, or just old-school __auto_load() which will speed up your applications a bit:


function __autoload($class) {
    include str_replace('_', '/', $class) . '.php';
}

i run the xampp and called this code below,

Can’t help you with that because I am starting all my ZF projects manually. I have a blank Zend Framework template and I just copy and paste it to a new directory, add a new virtual host and I can start coding.

A longer example of set_include_path():



// define BASE_PATH constant
define('BASE_PATH', dirname(dirname(__FILE__)));

// define APPLICATION_PATH constant
define('APPLICATION_PATH', BASE_PATH . '/application');

// set the include path
set_include_path(BASE_PATH
                 . '/../../library'
                 . PATH_SEPARATOR
                 . get_include_path());

// autoload classes from the library
function __autoload($class) {
    include str_replace('_', '/', $class) . '.php';
}

In this case the Zend folder is placed just outside the www directory in a folder called library. So the path to it is:


C:\\wamp\\library\\Zend

Document root is in this folder:


C:\\wamp\\www\\myzfproject

This is the virtual host setup:


NameVirtualHost *:80
<VirtualHost *:80>
    ServerName myproject
    DocumentRoot "C:\\wamp\\www\\myzfproject"
</VirtualHost>

I believe the above code would work also with XAMPP (it has xampp/www document root if I remember correctly).

putting \zf\bin in php.ini isn’t going to help you with the zf command line tool, you’d need to make sure the zf executable is accessible to your shell environment. I don’t use windows but I think it’d be a good idea to google ‘zend tool windows’ for some tips on setting up zend tool for your machine.