RE: [PHP] include() syntax

From: Date: Wed, 27 Sep 2000 05:40:37 +0000
Subject: RE: [PHP] include() syntax
Groups: php.general 
Request: Send a blank email to php-general+get-17722@lists.php.net to get a copy of this message
Use $DOCUMENT_ROOT eg require $DOCUMENT_ROOT."/phpcommon/settings.ini"; or in your case require $DOCUMENT_ROOT."/inc/links.php"; $DOCUMENT_ROOT is from the root directory to your web root probably something like /user/home/yourusername/www There is no leading slash on $DOCUMENT_ROOT (well, at least on my php 4.02 :) ) Cheers, Lawrence. -----Original Message----- From: David Askov [mailto:dca@riverside.com] Sent: September 22, 2000 10:08 PM To: php-general@lists.php.net Subject: [PHP] include() syntax Hi all, I'm trying to work through include function syntax. I am working in a directory called "news" and trying to include a file in a directory next to it called "inc". Both directories are under "/dca" of the server's root. When I try to include "../inc/links.php" it works just fine, but I'd prefer to specify a pathname from the server root than a relative pathname. That way, I could use the same call from any level of the directory structure. I guess the problem is that php treats that as a URL, not a local pathname. When I try to include the file from the web server root path, "/dca/inc/links.php", I get a parse error "Warning: failed opening". When I try this: include("http://" . $SERVER_NAME . "/dca/inc/linklist.php"); The file gets included and executes, but no variables that were previously set are used, so the links.php does not produce the desired results. I get similar results from the require function. I fiddled with fopen() a little, but concluded that I should ask for help at that point. Any ideas or suggestions please? Thanks, David ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ David Askov dca@riverside.com Riverside Technology, inc. 2290 E. Prospect Rd., Suite 1 Fort Collins, CO 80521 http://www.riverside.com P: (970)484-7573 F: (970)484-7593 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#17722) next »