open_basedir restriction in effect error in PHP

This is a discussion on "open_basedir restriction in effect error in PHP" within the PHP Forum section. This forum, and the thread "open_basedir restriction in effect error in PHP are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 25th, 2008, 12:20
Banned Member
Join Date: Feb 2008
Location: London
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
open_basedir restriction in effect error in PHP

This must be one of the most annoying errors to get when working with php. This error occurs when PHP can't find the specified file in the include statement. This often occurs when a developer has built an application on their machine and uploaded the application to a shared hosting account or if they move the application to a sub folder.

An easy work around is to determine the path to the called file dynamically.

PHP: Select all

$folcnt substr_count($_SERVER["PHP_SELF"], "/");
$folappstep "";
if(
$folcnt 1) {
 for(
$i=2;$i<=$folcnt;$i++) {
  
$folappstep .= "../";
 }
} else {
 
$folappstep "";
}

$extfile $folappstep."ws8_extensions.php";
$funfile $folappstep."ws8_functions.php";

include 
$extfile;
include 
$funfile
Thanks

Ben

Last edited by Rob; Feb 28th, 2008 at 10:57. Reason: making use of [php][/php] tag
Reply With Quote

Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
css hover effect error jlbantang Web Page Design 6 Oct 13th, 2007 12:30
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 Classic ASP 2 Aug 7th, 2007 12:00
open_basedir work around Gee Bee PHP Forum 0 May 3rd, 2007 12:58
Error 500 - Internal server error JasonStanley PHP Forum 3 Apr 23rd, 2007 17:56


All times are GMT. The time now is 07:32.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43