Re: require, include problems

From: Date: Thu, 16 Nov 2000 20:03:36 +0000
Subject: Re: require, include problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25772@lists.php.net to get a copy of this message
On Thu, 16 Nov 2000 11:44:08 -0800, Jerry Lake (jerryl@europa.com) wrote: >Maybe this has been discussed, but >I could not find my specific question. > >why is it that on includes and requires >I can't call them from the root like ><? >require("/global_includes/css.inc"); >?> >instead it only works like this(on internal pages) ><? >require("../global_includes/css.inc"); >?> >Hopefully I am just missing something dumb, >I'd like to be able to include a file without having >a massive trail of dots and /'s ><? >require("../../../../../global_includes/css.inc"); >?> Hi Jerry, On unix you can set include_dir in your php.ini, or (if you're doing the apache module) in httpd.conf like so: php_value include_path /path/to/doc_root then you can include a file in your document root like this: include("myinc.inc"); or you could use absolute paths (from the top, not from the document root): include("/usr/local/apache/htdocs/myinc.inc"); If you're using Apache/windows with virtual hosts, you're out of luck. - Mark

« previous php.general (#25772) next »