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. We restrict all PHP scripts to operating within the home user directory to which they belong for security reasons.
Your php scripts will also cause these errors if you are trying to access them from a temp URL such as http://serverip/~username/. However if you try to access them via the proper domain, they should not give these errors.
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
We 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. We however, like many other hosts, have a policy of securing your PHP enabled webspace using the the open_basedir method for your own protection.