note 106631 added to function.get-include-path
| From: | vukoxx at gmail dot com | Date: | Wed, 23 Nov 2011 13:41:15 +0000 |
| Subject: | note 106631 added to function.get-include-path | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184636@lists.php.net to get a copy of this message | ||
@jcwebb
Adding '/' to your include path is probably not a good idea.
i've just tried it and i don't like it
<? include('etc/passwd'); ?>
Maybe you're better off by adding
<? set_include_path(get_include_path().PATH_SEPARATOR.dirname(__FILE__)); ?>
but that one would point to subdirectories as well
you can also add
<? set_include_path(get_include_path().PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT']); ?>
to your path, but you cannot rely on that one either (see Apache2/mod_vhost_alias)
i don't know what's best practice, but i strongly suggest to leave root out of your path.
My suggestion is to do it manually
<? set_include_path(get_include_path().PATH_SEPARATOR.'/var/www/explicit/path'); ?>
Regards, vuko.
----
Server IP: 85.214.154.209
Probable Submitter: 78.53.217.241
----
Manual Page -- http://www.php.net/manual/en/function.get-include-path.php
Edit -- https://master.php.net/note/edit/106631
Del: integrated -- https://master.php.net/note/delete/106631/integrated
Del: useless -- https://master.php.net/note/delete/106631/useless
Del: bad code -- https://master.php.net/note/delete/106631/bad+code
Del: spam -- https://master.php.net/note/delete/106631/spam
Del: non-english -- https://master.php.net/note/delete/106631/non-english
Del: in docs -- https://master.php.net/note/delete/106631/in+docs
Del: other reasons-- https://master.php.net/note/delete/106631
Reject -- https://master.php.net/note/reject/106631
Search -- https://master.php.net/manage/user-notes.php