zend problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eduard77
Forum Newbie
Posts: 17
Joined: Sun Nov 22, 2009 10:10 pm

zend problem

Post by eduard77 »

s the first time when I use Zend and I am a little comfused. I have this code
require_once('Zend/Loader.php'); and this error
Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\phpweb20\htdocs\index.php on line 3
I tought that I didn't do something well and I tried to fine manually the file loader.php but I couldn't find it. There is no such file.
Can anyone tell me what is wrong?
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: zend problem

Post by tr0gd0rr »

You need to add the Zend directory to your include path. You can do it in php.ini or in code:

Code: Select all

$incl = get_include_path();
// absolute path
set_include_path($incl . PATH_SEPARATOR . '/path/to/Zend/');
// OR path relative to current file
set_include_path($incl . PATH_SEPARATOR . dirname(__FILE__) . '/relative/path/to/Zend');
That is one thing that is kind of annoying about Zend: you have no choice but to update your include path.
eduard77
Forum Newbie
Posts: 17
Joined: Sun Nov 22, 2009 10:10 pm

Re: zend problem

Post by eduard77 »

Thank you for your answer.
I am reather new in php so please be more specific
The zend framwork is in:
c:/program files/wamp/www/webpage/include/ZendFramework-1.9.7
also the path for pear is
c:/program files/wamp/bin/php/pear
Do I need to configure the apache server also?
I included the path in php.ini also but the error is the same
Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\webpage\htdocs\index.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='.;C:\php5\pear') in C:\wamp\www\webpage\htdocs\index.php on line 3
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: zend problem

Post by tr0gd0rr »

eduard77 wrote:Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='.;C:\php5\pear') in C:\wamp\www\webpage\htdocs\index.php on line 3
Your include_path needs to be ''.;C:\php5\pear;c:/program files/wamp/www/webpage/include/ZendFramework-1.9.7"

You can change the include_path value in php.ini and restart apache or set your include path with set_include_path() before including Zend/Loader.php
eduard77
Forum Newbie
Posts: 17
Joined: Sun Nov 22, 2009 10:10 pm

Re: zend problem

Post by eduard77 »

Thanks but I just found out that mu Zend framework dosen't support Loader.php because they changed with aoutoloader.php.
So that was the problem.
Thanks anyway
It took me 1 day to figure it out but hey " no pain no gain" :banghead:
:banghead:
Post Reply