I have a zend library and for simplicity I put it in the root. ( /library/zend/...
) I added the path to my php.ini
include_path
and un-commented it. ( include_path = ".:/library/"
).
In my website files I have require_once 'Zend\\Loader.php';
But when I try to access the page I get:
Warning: require_once(Zend/Loader.php): failed to open stream:
No such file or directory in /var/www/TEST/index.php on line 7
Fatal error: require_once(): Failed opening required 'Zend/Loader.php'
(include_path='.:/usr/share/php:/usr/share/pear')
in /var/www/TEST/index.php on line 7
Why is it looking for pear? Those directories do not even exist.
I have required the full path and that worked (well then zend didnt know where to look for everything else but it was able to find loader.php) so I think that means permissions are okay. I have tried adding/removing a trailing slash in the include path and a preceding slash in the php website file.
The only thing i could find on google was something about a .htaccess? Not sure what or where that is.
I am editing the right php.ini
file because i am able to turn error reporting on and off from it.
Both doc_root and include_path have been changed but fail to show changes in phpinfo() even though phpinfo() says i am editing the right php.ini file
When you change the include_path
in php.ini the change will affect all your projects.
Better idea would be to use set_include_path
and get_include_path
php functions to update the path just for the current application.
Remember, that the path must be an absolute path , so this will be more or less like this:
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
APPLICATION_PATH . '/../vendor/',
get_include_path(),
)));
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.