Hi
I have installed ZenPhoto and after the install the admin (backend) works fine, but the frontend gives the following error:
Warning: main(): Unable to access classes.php in /home/maengho/gallery/zen/template-functions.php on line 7
Warning: main(classes.php): failed to open stream: No such file or directory in /home/maengho/gallery/zen/template-functions.php on line 7
Fatal error: main(): Failed opening required 'classes.php' (include_path='') in /home/maengho/gallery/zen/template-functions.php on line 7
I think its the include path in require_once that fails, because when the first file, template-functions.php, is included in index.php, it tries to include classes.php from the same location as index.php. Knowing that I added /zen on all require_once. It worked, but now the admin (backend) doesn't work, because it tries to include the files from the /zen which now becomes zen/zen.
I've tried the solutions by setting the paths with define, but they dont work in any way.
As I see the problem, its caused because the script tries to use the same files in two different contexts, where the include path for needed files is not the same.
Have anyone experienced the same problem and know a solution?
Comments
That's not the correct behavior ;-) It should always look in the same directory as the current file.
If you actually want it to work under your setup, just add this to every include...
require_once(dirname(__FILE__) . "/filename.php);
But I would try to fix this bug, it's weird. Seems to be related to this....
http://us3.php.net/manual/en/function.include.php#38000
<Trisweb said>
That's not the correct behavior ;-) It should always look in the same directory as the current file.
</Trisweb said>
Yes, but here I think the current file is index.php, its the one being executed, and it includes zen/template-functions.php, so now the code from template-functions.php is in index.php, and when it needs to include files from the code in template-functions.php the path have to be set from the location of index.php.
That is what I've always done, but I made a simple test on another host, where both ways worked - so I actually learned something today :-)
I will try your solution, and return.