Re: [PHP] Where to put my class files
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to put my class files
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? nothing as such - looks like you might be on a Plesk webhosting platform. you have a number of options: 1. ask the sys admin to relax the openbasedir restriction for your domains so that you can reach your httpdocs dir from your httpsdocs. 2. copy the class files into a httpsdocs [sub]dir 3. er? /Peter -Original Message- From: Chris [mailto:[EMAIL PROTECTED] 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/'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where to put my class files
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:[EMAIL PROTECTED] 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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Where to put my class files
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 -Original Message- From: Chris [mailto:[EMAIL PROTECTED] 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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Where to put my class files
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 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/'; But it does not work. Help me; I will kill myself soon... :) Best regards, Peter Lauri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php