[PHP] require() in other directories?
Best groupmember, I have an webapplication that uses different languages and therefor I have set up different directorys for each language. All languages use the same classes. The problem I have is when I want to require() the classfile I can not require a file that is not in the same directory as my .php file. I have tried the following: require(../classes.php); require(http://www.mydomain.com/classes.php;); and more. All gives me error messages, why? Anyone that could help me? - Best Of Times /Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require() in other directories?
What error happen? On Thu, 18 Nov 2004 09:15:22 +0100, Peter Lauri [EMAIL PROTECTED] wrote: Best groupmember, I have an webapplication that uses different languages and therefor I have set up different directorys for each language. All languages use the same classes. The problem I have is when I want to require() the classfile I can not require a file that is not in the same directory as my .php file. I have tried the following: require(../classes.php); require(http://www.mydomain.com/classes.php;); and more. All gives me error messages, why? Anyone that could help me? - Best Of Times /Peter -- 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] require() in other directories?
I get the Failed to open stream, no such file in directory If you were in one of these folders: /fr/ /eng/ And your classfile was namned classes.php and in the directory: /classes/ And you wanted to include the classfile, how would you write it? I would assume: require(/classes/classes.php); But that doesn't work. Help :) Pluance [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] What error happen? On Thu, 18 Nov 2004 09:15:22 +0100, Peter Lauri [EMAIL PROTECTED] wrote: Best groupmember, I have an webapplication that uses different languages and therefor I have set up different directorys for each language. All languages use the same classes. The problem I have is when I want to require() the classfile I can not require a file that is not in the same directory as my .php file. I have tried the following: require(../classes.php); require(http://www.mydomain.com/classes.php;); and more. All gives me error messages, why? Anyone that could help me? - Best Of Times /Peter -- 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] require() in other directories?
On Thursday 18 November 2004 16:32, Peter Lauri wrote: I get the Failed to open stream, no such file in directory If you were in one of these folders: /fr/ /eng/ And your classfile was namned classes.php and in the directory: /classes/ And you wanted to include the classfile, how would you write it? I would assume: require(/classes/classes.php); No because PHP would be trying to find the 'classes' directory in the root level of your filesystem. The best way to deal with it would be to add /full/path/to/classes into your include_path, then you can simply use include('classes.php'). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Will you loan me $20.00 and only give me ten of it? That way, you will owe me ten, and I'll owe you ten, and we'll be even! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require() in other directories?
But if I am working on a webserver it would try to find it in the root of my webserver, or am I wrong? For example I use that notation with an image: I use this: img src='/image/theimage.gif' Is this not the case for the PHP-scripting? /Peter Jason Wong [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] On Thursday 18 November 2004 16:32, Peter Lauri wrote: I get the Failed to open stream, no such file in directory If you were in one of these folders: /fr/ /eng/ And your classfile was namned classes.php and in the directory: /classes/ And you wanted to include the classfile, how would you write it? I would assume: require(/classes/classes.php); No because PHP would be trying to find the 'classes' directory in the root level of your filesystem. The best way to deal with it would be to add /full/path/to/classes into your include_path, then you can simply use include('classes.php'). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Will you loan me $20.00 and only give me ten of it? That way, you will owe me ten, and I'll owe you ten, and we'll be even! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require() in other directories?
On Thursday 18 November 2004 19:45, Peter Lauri wrote: Please do not top post. But if I am working on a webserver it would try to find it in the root of my webserver, or am I wrong? For example I use that notation with an image: I use this: img src='/image/theimage.gif' That is your 'webroot'. Is this not the case for the PHP-scripting? No, $_SERVER['DOCUMENT_ROOT'] is what you need to prepend in front directories. BTW using relative paths for include should work. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Television -- the longest amateur night in history. -- Robert Carson */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require() in other directories?
Peter Lauri wrote: I get the Failed to open stream, no such file in directory If you were in one of these folders: /fr/ /eng/ And your classfile was namned classes.php and in the directory: /classes/ And you wanted to include the classfile, how would you write it? I would assume: require(/classes/classes.php); require(classes/classes.php); But that doesn't work. Help :) Pluance [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] What error happen? On Thu, 18 Nov 2004 09:15:22 +0100, Peter Lauri [EMAIL PROTECTED] wrote: Best groupmember, I have an webapplication that uses different languages and therefor I have set up different directorys for each language. All languages use the same classes. The problem I have is when I want to require() the classfile I can not require a file that is not in the same directory as my .php file. I have tried the following: require(../classes.php); require(http://www.mydomain.com/classes.php;); and more. All gives me error messages, why? Anyone that could help me? - Best Of Times /Peter -- 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