zend and smarty site clone problem
I created a site a while ago using zend and smarty. The site is hosted on a virtual machine with centOS. Now I want to create a similar site so I creeated another virtual host, ftp user etc etc on the same machine.
I modified the ini file that contained the paths: paths.base = /var/www/html/new_path
paths.data 开发者_C百科= /var/www/html/new_path/data paths.templates = /var/www/html/new_path/templates paths.cache = /var/www/html/new_path/data/tmp/cache paths.public = /var/www/html/new_path/public_htmlThe porblem is that somehow when I try to access zend/loader.php (I try to load a database object) it is used the loader from the old path (/var/www/html/oldpath/include/zend/loader.php) so naturally I cant access any new objects I create for the new site ( Warning: include_once(DatabaseObject/New.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/html/old_path/include/Zend/Loader.php on line 146
Warning: include_once() [function.include]: Failed opening 'DatabaseObject/New.php' for inclusion (include_path='.:/var/www/html/old_path/include:/usr/share/pear/') in /var/www/html/old_path/include/Zend/Loader.php on line 146
Fatal error: Class 'DatabaseObject_Chat' not found in /var/www/html/new_path/include/Controllers/ChatController.php on line 8 ).
There are no other paths defined anywhere. Caching is disabled. It occurs on different computers, browsers, etc so is not a local problem (residual value of some-type).
For any details just ask... I'm stuck.
Zend_Loader looks into include directories defined in your public/index.php. The include path must be set properly to contain both the old directories and the new ones. Note the respective order specified by your include path.
The code in public/index.php should look similar to the following, assuming the use of ZF1:
<?php
...
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../../project_name/path_for_inclusion'),
get_include_path(),
)));
...
The include path can be also adjusted in your .htaccess:
php_value include_path "/var/www/path:/var/www/second_path:/var/www/third"
or you can achieve the effect in general without ZF-specific code:
set_include_path(get_include_path() . PATH_SEPARATOR . $path_to_add);
精彩评论