Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: require_once() errors
06-03-2007, 08:55 PM #1
- Join Date
- Jun 2007
- Thanked 0 Times in 0 Posts
I have made a php script for checking sure that a form is filled out correctly.
The problem the register.php that has the php script does not load it comes up with three errors and i cant seem to fix it.
I have been trying to fix the errors for 3 days and have made no head ways.
The errors are
Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/Connections/userlogin.php) is not within the allowed path(s): (/tmp:/usr/share/pear:/home/fhlinux169/m/maltmandarkblues.co.uk/user) in /home/fhlinux169/m/maltmandarkblues.co.uk/user/htdocs/Register.php on line 2
Warning: require_once(/Connections/userlogin.php) [function.require-once]: failed to open stream: Operation not permitted in /home/fhlinux169/m/maltmandarkblues.co.uk/user/htdocs/Register.php on line 2
Fatal error: require_once() [function.require]: Failed opening required '/Connections/userlogin.php' (include_path='.:/usr/share/pear-php5') in /home/fhlinux169/m/maltmandarkblues.co.uk/user/htdocs/Register.php on line 2
The line of code it fails at is
require_once('/Connections/userlogin.php'); //Connect to the SQL database
I think its a server side php setting needs changed but im not sure.
Please help guys.
06-03-2007, 09:05 PM #2
- Join Date
- Dec 2004
- In a place far, far away...
- Thanked 1,043 Times in 1,019 Posts
require and include are allowed to include files from the home directory of your site meaning it can go past the public_html folder. Try this
You had a leading / in there telling it to go to the very root of the site. You might want to check what $_SERVER['DOCUMENT_ROOT'] returns. It should show you your public_html directory but can be something else. Or if you put want it above the public directory then make sure its in a place that you can access it. You can usually tell if you can access it if you log in using FTP. You will get all of the areas you are able to access.PHP Code:
require_once($_SERVER['DOCUMENT_ROOT'].'Connections/userlogin.php'); //Connect to the SQL database