Re: Where to put my class files

From: Date: Tue, 28 Feb 2006 07:52:15 +0000
Subject: Re: Where to put my class files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-231188@lists.php.net to get a copy of this message
Peter Lauri wrote:
I tried this, but now I get this error. Warning: main(): open_basedir restriction in effect. File(/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/ orderadmin.class.php) is not within the allowed path(s): (/home/httpd/vhosts/mydomain.com/httpsdocs:/tmp) in /home/httpd/vhosts/ mydomain.com/httpsdocs/admin/index.php on line 4 Warning: main(/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/ orderadmin.class.php): failed to open stream: Operation not permitted in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/index.php on line 4 Fatal error: main(): Failed opening required '/home/httpd/vhosts/mydomain.com/httpsdocs/admin/../../httpdocs/classes/orde radmin.class.php' (include_path='.:/usr/share/pear') in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/index.php on line 4 mydomain.com is just something I replaced the real domain name with. What I am doing wrong? /Peter
You're not doing anything wrong. Your host locks you into the '/home/httpd/vhosts/mydomain.com/httpsdocs/' folder so you can't include any scripts outside that directory. The only thing you can do is ask them to adjust the open_basedir restrictions and allow you to include in the '/home/httpd/vhosts/mydomain.com/httpdocs/' directory as well. They should be able to do this just by adding something to your apache config. (Search www.php.net for what open_basedir does).
-----Original Message----- From: Chris [mailto:dmagick@gmail.com] Sent: Tuesday, February 28, 2006 1:45 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Where to put my class files Peter Lauri wrote:
Best group member, I want to run the backend of the system under HTTPS for security reasons. The pages in HTTP and HTTPS are both using the same classfiles. Right now I have the class files in httpdocs/classes/ In the httpsdocs/admin I have a variable $class_path='http://www.mydomain.com/classes/'; to describe where the
class
files can be found. I do this that does not generate an error: require_once($class_path.'orderadmin.class.php');
Including them this way will have already processed the php. It's like viewing the file using a browser.
When I then do below it gives be an error. echo OrderAdmin::getNewOrderList(); Fatal error: Undefined class name 'orderadmin' in /home/httpd/vhosts/mydomain.com/httpsdocs/admin/order.php on line 46 When running on the localhost and with the admin in a subfolder in HTTP it is no problems. Where should I locate my class files so that they are visible for both
HTTP
and HTTPS? And how should I set my $class_path? I do not think my $class_path is good enoght, because then I would not have that problem. I have tried: $class_path='../../http/classes/';
You need to do something like: // this gives you /home/httpd/vhosts/mydomain.com/httpsdocs/admin $my_path = dirname(__FILE__); // go back to the other folder. $class_path = $my_path . '/../../httpdocs/classes/';
-- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#231188) next »