简体   繁体   中英

Zend Framework php.ini include path

so, I'm trying to get Zend Framework running, which has terribly vague instructions.

It simply says, put the Zend folder in the directory, and add it to your include_path in php.ini .

So, this is my include path:

include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/tuner/public_html/market/Zend_1.12.3/library"

This is the section that should be including Zend, I have double checked the path:

/home/tuner/public_html/market/Zend_1.12.3/library

However, when I try to include a Zend class, I am still getting errors as though it is not included properly.

This is what is causing the error:

$locale = new Zend_Locale('en_CA');
Zend_Registry::set('Zend_Locale', $locale);

What am I doing wrong when including the framework?

You say you get an error when you try and include ZF class, but nowhere in the code you posted are you including a class (eg require_once 'Zend/Locale.php'; ). If you want ZF classes to be automatically included when you try and use them (which is the recommended approach), you need to setup the autoloader . For ZF1, add the following somewhere above your existing code:

require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();

ZF classes will then be automatically required in on demand.

I don't know which docs you got the code snippet from, but you are mixing up ZF1 and ZF2. The part with Zend_Locale and Zend_Registry are ZF1 components, so this is clearly not going to work with the ZF2 library installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM