Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 02-20-2006, 11:42 AM   #1
Solid State Member
Join Date: Aug 2005
Posts: 20
Default php error

im sort of new to php coding. when i upload the file and try to execute it, i get this error

Warning: main(): open_basedir restriction in effect. etc here.

what does that error mean? how do i correct it?

zonogon is offline   Reply With Quote
Old 02-20-2006, 11:47 AM   #2
Site Team
root's Avatar
Join Date: Mar 2004
Posts: 8,043
Default Re: php error


this explains it better than I could write myself...
PHP: "open_basedir" messages when running PHP scripts

The problem:
Your PHP script, when run, generates an message similar or the same as: "Warning: open_basedir restriction in effect. File is in wrong directory". The script will normally stop running after generating this error message.

Why does this message happen?
The security message in question is caused by your script attempting to do something it should not be doing. In most cases the script is attempting to access an area or file outside of your allocated webspace which, of course, is not permitted. The script may be attempting to open a file for reading or moving a file on the system, for example. SupaNames restrict all PHP scripts to operating within the home user directory to which they belong for security reasons.

How can I resolve this problem?
You will need to look at your script in detail and change any parts of the script that are incorrectly attempting to access files or areas outside of your webspace. Ensure that any commands or functions within your script that are designed to read, open or write to files are opening the file in the correct location by using the correct, local, path.

My image upload script is producing this error for no reason...
If you experience the open_basedir security message when using an image upload script we recommend that you change any copy() commands found within the script to the command move_uploaded_file(). More information on the move_uploaded_file() command can be found here.

But my scripts worked before without generating this message...
SupaNames make constant evaluations of our server security and have recently changed our method of restricting users to their own webspace meaning this message will now be produced should your script do something that it should not be doing. Generation of this message should be taken as notification that your script needs to be altered to continue with safe operation.

The same script works fine on another server / host...
Many hosts use the open_basedir method for adding security to shared web hosting servers. Some hosts also use safe_mode for the operation of PHP which offers this and several other restrictions. In general different hosts use different systems in order to protect the security of their web servers. Those that either don't bother securing your webspace and the running of PHP scripts or use a different method for doing so may not generate open_basedir messages on execution of an insecure script. SupaNames however, like many other hosts, have a policy of securing your PHP enabled webspace using the the open_basedir method for your own protection.

I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 02-20-2006, 12:10 PM   #3
Solid State Member
Join Date: Aug 2005
Posts: 20
Default Re: php error

Hmmm thanks =]
zonogon is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off

All times are GMT -5. The time now is 02:24 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0