简体   繁体   中英

Zend: How to prevent double library in includePath?

Zend Quick Start

public/index.php

set_include_path(implode(PATH_SEPARATOR, array(
    dirname(dirname(__FILE__)) . '/library',
    get_include_path(),
)));

configs/application.ini

includePaths.library = APPLICATION_PATH "/../library"

As a result

print get_include_path();
// prints %localpath%/application/../library:%localpath%/library

if drop "includePaths.library" from ini, ./zf (Zend_Tool) fails. If drop in index.php, bootstraping fails.

How to correctly prevent this duplicate?

I think you're right that the include path shouldn't be in application.ini as well, so I'd remove that. Then to get Zend Tool working, I think you have two options:

  1. Change your setup to be like the top answer in this question: Zend tool include path (which will help ZF find the include path). ZF's auto discovery was changed somewhere along the way though so I'm not sure if this approach will still work.

  2. Alternatively there is an environment variable you can set to give Zend Tool the library location, details here: http://framework.zend.com/manual/1.12/en/zend.tool.framework.clitool.html (see the section titled "Other Setup Considerations").

Personally I would just skip Zend Tool - I don't think it really makes things easier.

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