Re: Where to put my class files

From: Date: Tue, 28 Feb 2006 18:30:13 +0000
Subject: Re: Where to put my class files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-231216@lists.php.net to get a copy of this message
On Tue, Feb 28, 2006 at 12:55:18PM +0700, 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'); > > 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 It looks like you have a dir structure like: mydomain.com/httpsdocs/ #https docs mydomain.com/httpdocs/ #http docs What I would do is make a directory: mydomain.com/include/ And set my include_path to include that directory, and since it appears you have open_basedir in effect, include the path in open_basedir as well. Then put your classes in: mydomain.com/include/classes/ Then both sets of scripts can use: $class_path = 'classes/'; require_once($class_path.'orderadmin.class.php'); That is how I would do it. Curt. -- cat .signature: No such file or directory

« previous php.general (#231216) next »