0

How to set_include_path for php project?

Now I set path is

include('Zend/Search/Lucene.php');<br>
set_include_path('Zend'.PATH_SEPARATOR.get_include_path());<br>
require_once('Zend/Loader.php');

and directory for save this project is

C:\AppServ\www\Search

in this folder has Zend (Zend is the library of ZF)

Now it show

Warning: Zend_Search_Lucene_Storage_Directory_Filesystem::require_once(Zend/Search/Lucene/Storage/File/Filesystem.php) [zend-search-lucene-storage-directory-filesystem.require-once]: failed to open stream: No such file or directory in C:\AppServ\www\Search\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 349

Fatal error: Zend_Search_Lucene_Storage_Directory_Filesystem::require_once() [function.require]: Failed opening required 'Zend/Search/Lucene/Storage/File/Filesystem.php' (include_path='/Search/Zend/;.;C:\php5\pear') in C:\AppServ\www\Search\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 349

Help me please.

Sivaprakash
  • 455
  • 1
  • 8
  • 22
Panda Pat
  • 1
  • 1

1 Answers1

1

Your include path should be set to the folder that includes the Zend folder, it shouldn't be set to the Zend folder itself. So assuming that the correct location of the Lucene.php file is C:\AppServ\www\Search\Zend\Search\Lucene.php you want:

set_include_path("C:\AppServ\www\Search".PATH_SEPARATOR.get_include_path());

Also, don't try and include the file before setting the include path (as you are in your example) as this will fail.

Generally classes like this should sit outside of your web root, and you probably don't want to hard-code in a full path like "C:\AppServ" as this is specific to what is presumably your development environment.

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69