Hello guys
can you show me a good tutorial, on how to properly setup Zend Framework under XAMPP.
Thank you veyy much in advance.
| SitePoint Sponsor |
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...
Done...PHP Code:<?php
require 'path/to/zend/loader.php';
Zend_Loader::registerAutoload();
@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,
i run the xampp and called this code below,Code:include_path = ".;C:\xampp\php\PEAR;c:\zf\library;c:\zf\bin"
but unfortunately it doesn't work.Code:% zf create project quickstart
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:
PHP Code:function __autoload($class) {
include str_replace('_', '/', $class) . '.php';
}




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.i run the xampp and called this code below,




A longer example of set_include_path():
In this case the Zend folder is placed just outside the www directory in a folder called library. So the path to it is:PHP Code:
// 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';
}
Document root is in this folder:Code:C:\wamp\library\Zend
This is the virtual host setup:Code:C:\wamp\www\myzfproject
I believe the above code would work also with XAMPP (it has xampp/www document root if I remember correctly).Code:NameVirtualHost *:80 <VirtualHost *:80> ServerName myproject DocumentRoot "C:\wamp\www\myzfproject" </VirtualHost>



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.
Bookmarks