php error

zonogon

Solid State Member
Messages
20
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?
 
http://www.supanames.com/support/open_basedir.html

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.
 
Back
Top Bottom