Hi All,
I recently upgraded the PHP on our companies intranet server to PHP 5. This caused all of my includes in my PHP scripts to stop working.
Does anybody know how to solve this. I suspect that the problem is down to a setting in my php.ini file however I'm not sure what setting it could be.
I've tried changing the 'include_path' setting in php.ini but it doesn'se seem to have any effect.
Has anybody else had this problem and know how to fix it??
Thanks for your help in advance guys!
Includes not working since I upgraded to PHP5
Moderator: General Moderators
Ok my script includes another php script containing my database connection details using the following command:
include ("../connect.php");
The connect.php script is located in the directory above my main script. However when I run my main script it is not picking up the connect.php script in the directory above and so won't connect to the database. This worked ok in my old PHP 4 install.
Perhaps it has someting to do with the path to the included file, it doesn't appear to like the ../ part of the path??
It works if I have the included file in the same directory as the file where the include is called from, using just: include ("connect.php"), but I need the connect.php file in the directory above my main script.
include ("../connect.php");
The connect.php script is located in the directory above my main script. However when I run my main script it is not picking up the connect.php script in the directory above and so won't connect to the database. This worked ok in my old PHP 4 install.
Perhaps it has someting to do with the path to the included file, it doesn't appear to like the ../ part of the path??
It works if I have the included file in the same directory as the file where the include is called from, using just: include ("connect.php"), but I need the connect.php file in the directory above my main script.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Errors?
I assume you've got error reporting turned on?
I assume you've got error reporting turned on?
Code: Select all
<?php
error_reporting(E_ALL);
?>Ok i've fixed the problem, the error that was getting reported was:
open_basedir restriction in effect. File(../connect.php) is not within the allowed path(s): (.;sys:/tmp)
I found the following entry in my php.ini file:
open_basedir = ".;sys:/tmp"
I then commented this line out and now it works. It seems that if the open_basedir is set, this limits file operations to the directories specified in the open_basedir setting. By commenting this line I'm assuming that it allows file operations in any directory rather than just limiting it to the specified directory.
Thanks for all your help.
open_basedir restriction in effect. File(../connect.php) is not within the allowed path(s): (.;sys:/tmp)
I found the following entry in my php.ini file:
open_basedir = ".;sys:/tmp"
I then commented this line out and now it works. It seems that if the open_basedir is set, this limits file operations to the directories specified in the open_basedir setting. By commenting this line I'm assuming that it allows file operations in any directory rather than just limiting it to the specified directory.
Thanks for all your help.