Re: [PHP] Parent Limits?
On Tue, Jun 21, 2011 at 00:35, Brian Smither wrote: > > The following works (three parents): > include("../../../includes/ini.inc.php"); > require_once("../../../includes/ini.inc.php"); > > The following works (four parents): > include("../../../../includes/ini.inc.php"); > > The following does not work (four parents): > require_once("../../../../includes/ini.inc.php"); For portability, you may want to consider dirname(). This means that, if that file is included from another directory, the ../ calls are dynamic (relevant to the executed file, not the included file), so it will break unless the directories are equal in depth. Conversely, dirname() is static regardless of location. Thus: That will work regardless of whether it's the included file or the executed file. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parent Limits?
Why not set a constants for a base path and then you do not have to do that? define('BASE_PATH','C:\\inetpub\\vhosts\\yourwebsite.com\\httpdocs\\'); <--windows format for path define('DIR_INCLUDES', './includes'); require_once(BASE_PATH.DIR_INCLUDES.'ini.inc.php'); Richard L. Buskirk -Original Message- From: Brian Smither [mailto:bhsmit...@gmail.com] Sent: Tuesday, June 21, 2011 12:35 AM To: php-general@lists.php.net Subject: [PHP] Parent Limits? The following works (three parents): include("../../../includes/ini.inc.php"); require_once("../../../includes/ini.inc.php"); The following works (four parents): include("../../../../includes/ini.inc.php"); The following does not work (four parents): require_once("../../../../includes/ini.inc.php"); That is, require_once() with four parents has been reported to have been disabled for security purposes. But apparently, not disabled is include() with four parents. The device or setting which is causing the problem is not known to me. It may be just the four parents (and include() is getting the data from this file elsewhere) or it may be the combination. It has been reported this is not a limit within open_basedir. So, what is it? What module or php.ini setting would have this effect? Thank you. -- 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
[PHP] Parent Limits?
The following works (three parents): include("../../../includes/ini.inc.php"); require_once("../../../includes/ini.inc.php"); The following works (four parents): include("../../../../includes/ini.inc.php"); The following does not work (four parents): require_once("../../../../includes/ini.inc.php"); That is, require_once() with four parents has been reported to have been disabled for security purposes. But apparently, not disabled is include() with four parents. The device or setting which is causing the problem is not known to me. It may be just the four parents (and include() is getting the data from this file elsewhere) or it may be the combination. It has been reported this is not a limit within open_basedir. So, what is it? What module or php.ini setting would have this effect? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php