PHP Classes

Class Error in function

Recommend this page to a friend!

      PHP 5 Interface Browser  >  All threads  >  Class Error in function  >  (Un) Subscribe thread alerts  
Subject:Class Error in function
Summary:the function get_include_path() won't work at my server
Messages:5
Author:Karl Masche
Date:2008-11-26 03:00:51
Update:2008-12-03 06:52:29
 

 


  1. Class Error in function   Reply   Report abuse  
Picture of Karl Masche Karl Masche - 2008-11-26 03:00:52
Warning: dir(.:) [function.dir]: failed to open dir: No such file or directory in /usr/export/www/vhosts/php5_browser/class.classes.php on line 69

Fatal error: Call to a member function read() on a non-object in /usr/export/www/vhosts/php5_browser/class.classes.php on line 70

  2. Re: Class Error in function   Reply   Report abuse  
Picture of Carl Friis-Hansen Carl Friis-Hansen - 2008-11-26 09:06:24 - In reply to message 1 from Karl Masche
I am almost certain it is caused by the include_path being currently empty or wrong. At least the last path in the include_path must exist. If you do not own the server and therefore cannot modify include_path in the php.ini file, then you could add the following in the constructor of the class:

//////////////////////////////
$path = '/usr/lib/pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
//////////////////////////////

Put an existing directory in instead of '/usr/lib/pear'. It could be a directory under your own document root or anywhere else, just make sure the apache server has permission to read the files.

Hope this helps

Carl Friis-Hansen

  3. Re: Class Error in function   Reply   Report abuse  
Picture of Karl Masche Karl Masche - 2008-11-30 20:04:03 - In reply to message 2 from Carl Friis-Hansen
Thanks for this answer, but my Server don't accept a path at root level it stops with a security message I am out of the path what allowed.
I can't take a path / on root I could take only a path with the beginning of the webspace. This is possible usr/lib/pear but no /usr/lib/pear.



  4. Re: Class Error in function   Reply   Report abuse  
Picture of Carl Friis-Hansen Carl Friis-Hansen - 2008-11-30 20:33:22 - In reply to message 3 from Karl Masche
But that's fine. As I said, just substitute the example path with something you have or can have on your server. What about "classes" and then put a .htaccess and .htpasswd thing in that directory to avoid people moving their browser into that directory, but still have a password, so you personally can browse your classes.
There is no reason this should not work.

Oh, if you are not too familiar with password protection in apache, then have a read of this:
httpd.apache.org/docs/2.0/programs/ ...

  5. Re: Class Error in function   Reply   Report abuse  
Picture of Karl Masche Karl Masche - 2008-12-03 06:52:29 - In reply to message 4 from Carl Friis-Hansen
with the construct as you said I have this:

Warning: dir(.::class/php5_browser) [function.dir]: failed to open dir: No such file or directory in /usr/export/www/vhosts/class/php5_browser/class.classes.php on line 69

Fatal error: Call to a member function read() on a non-object in /usr/export/www/vhosts/class/php5_browser/class.classes.php on line 70

Is anything wrong how I take the construct. I take it to the man.php for testing or should it be inside of the class.classes.php.

I take a second server, on the second server I see nothing, no error message.

 
For more information send a message to info at phpclasses dot org.