note 13612 added to function.require.php
| From: | hoodooman at annwn dot de | Date: | Sun, 24 Jun 2001 16:22:54 +0000 |
| Subject: | note 13612 added to function.require.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14603@lists.php.net to get a copy of this message | ||
Hi,
thanks for your tips about require()ing with $DOCUMENT_ROOT. In vivo this runs well (my provider
uses Apache and PHP3/4), but I had problems in vitro (means at home) where I run Win2k, IIS 5 &
PHP4.0.5. I was surprised to find out that IIS doesn't set $DOCUMENT_ROOT! The following
workaround achieves pleasant results:
<code>
if ( strlen($DOCUMENT_ROOT) == 0) $DOCUMENT_ROOT = 'F:/MyWebs/annwn';
require_once($DOCUMENT_ROOT . '/inc/TTextField.class.php4');
</code>
If $DOCUMENT_ROOT is not set I'll set it to the physical path to my site on the server,
otherwise (e.g. when published) I leave it alone.
http://www.php.net/manual/en/function.require.php