views:

7408

answers:

4

I have dumped Zend Framework files in

"home/hotbuzz/public_html/include/zend/"

My hosting : linux

I want to load it in my script. Whenever I load I get this error.

Some info: I asked about my Zend, to hosting guys they said its located in "usr/local/zend"

But I want to use this home/hotbuzz/public_html/include/zend/

I had added these lined in my PHP:

set_include_path(dirname(__FILE__).';'.get_include_path());
require_once 'Zend/Loader.php';

I get this error

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Exception.php' (include_path='/home/hotbuzz/public_html/include;.:/usr/lib/php:/usr/local/lib/php') in /home/hotbuzz/public_html/include/Zend/Loader.php on line 87

I want to set include path in my PHP code and configure it (.htaccess).

+8  A: 

As I said in your previous question. Do not use ';' but use PATH_SEPARATOR. This is a PHP constant that represent the right separator for your system (semi-colon on windows and colon on linux)

set_include_path(dirname(__FILE__).PATH_SEPARATOR.get_include_path());
stunti
A: 

You may have more success if you use auto_prepend rather than include...

php_value include_path /home/hotbuzz/public_html/include/zend/
php_value auto_prepend_file Zend/Loader.php

What do you get in the apache log on startup and execution with that?

Uresu
+2  A: 

you were doing it write. you should call set_include_path in first lines of your main script (index.php) and then include/require zend framework files. remember to rename your Zend Framework containing folder to 'Zend' (uppercase Z) to follow ZF naming conversions. then put your Zend folder in your include directory.

<?php
$newIncludePath = array();
$newIncludePath[] = '.';
$newIncludePath[] = 'include';
$newIncludePath[] = get_include_path();
$newIncludePath = implode(PATH_SEPARATOR, $newIncludePath);
set_include_path($newIncludePath);
// now include path is setup and we can use zend
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoLoad('Zend_Loader', true);
// the rest of the code
?>

if you put your Zend directory in your include path, and not the include directory (that contains the Zend directory), you may not use this:

require_once 'Zend/Loader';

instead you should use:

require_once 'Loader';

which is not a good idea. by using the Zend/* model, you will remember which files are included from Zend Framework and which files are you own. so just add the include directory to your include path.

farzad
A: 

you can attach the below code in the first line of your bootstrap.php: set_include_path('.' . PATH_SEPARATOR . '../library' . PATH_SEPARATOR . '../application/models/' . PATH_SEPARATOR . get_include_path());

Pouya Fani