Require()?? absolute path.[SOLVED]
Moderator: General Moderators
Require()?? absolute path.[SOLVED]
I need to use the require function but I need to use a absolute path such as g:\website\inetpub\wwwroot\php
Is that possible? Here the dir structure
PHP-under PHP is Area, Armis, Live
Area, Armis and LIve each have North South West folders.
There are files in each North South West folder that make a DB connection. The guy who made the files put the connection details in each file and I am wanting to make one file and require it. I am wanting to put it into the php folder so that all the files can call it. I have tried
require("g:\website\inetpub\wwwroot\php\SoutDBConnection.php");
and it did not work.
Is that possible? Here the dir structure
PHP-under PHP is Area, Armis, Live
Area, Armis and LIve each have North South West folders.
There are files in each North South West folder that make a DB connection. The guy who made the files put the connection details in each file and I am wanting to make one file and require it. I am wanting to put it into the php folder so that all the files can call it. I have tried
require("g:\website\inetpub\wwwroot\php\SoutDBConnection.php");
and it did not work.
Last edited by james3302 on Mon Jul 07, 2008 7:18 am, edited 1 time in total.
The code you have should work. I do it all the time. Verify that the file exists, and turn on error reporting.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
include in php.ini
not every php file needs this file though. If I include it in the php.ini file then will every php file run it?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
You would only set the path of the file in the php.ini, not the file itself. Then, to simply include the file you would do
Code: Select all
include 'SoutDBConnection.php';- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Re: include in php.ini
You wouldn't set the full path to the file, only the path (without the filename.) Including would then be simply asking for the filename.james3302 wrote:not every php file needs this file though. If I include it in the php.ini file then will every php file run it?
on a different drive
PHP is installed on the C drive and the php files are on the G drive
and how do you turn on error reporting?
and how do you turn on error reporting?
okay im back
Had some server issues but Im back to working on this. The HD is partitioned into a C drive and a G drive. PHP is installed on the C drive and the website is on the G drive. If you suggest adding something to the php.ini file then please give me an example of how to add it. or any other suggestions I can try.
I have
;include_path = ".c:\php\includes"
which means its commented out, I just change that to
include_path = ".g:\website\..."
and then in the files use require(SouthDBConnection.php)
I have
;include_path = ".c:\php\includes"
which means its commented out, I just change that to
include_path = ".g:\website\..."
and then in the files use require(SouthDBConnection.php)