PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Donovan
Client


Joined: Oct 07, 2003
Posts: 691
Location: Ohio

PostPosted: Wed Sep 05, 2007 7:34 am Reply with quote Back to top

A couple questions about using $_SERVER['DOCUMENT_ROOT']

I am one level below the config.php file and am in my admin directory. I am having trouble connecting with the database and it is because I think the code cannot see the config.php

I used this to make sure I could find the config.php:

$CONF_PATH = $_SERVER['DOCUMENT_ROOT'];

then

require $CONF_PATH."xxxxx/includes/mysql.php";
require $CONF_PATH."xxxxx/includes/db.php";
require $CONF_PATH."xxxxx/config.php";

I am on a MAC OSX 10.4 Server

The $_SERVER['DOCUMENT_ROOT']; returns

/Library/WebServer/Document/

so it would be logical to concatenate that with "xxxxx/config.php";

Does it matter in what order I place these?

Code:
require $CONF_PATH."xxxxx/includes/mysql.php";
require $CONF_PATH."xxxxx/includes/db.php";
require $CONF_PATH."xxxxx/config.php";
View user's profile Send private message Visit poster's website ICQ Number
evaders99
Moderator


Joined: Apr 30, 2004
Posts: 2796

PostPosted: Wed Sep 05, 2007 5:36 pm Reply with quote Back to top

Does your PHP user have permissions to access that file? You can always check using the file_exists function
View user's profile Send private message Visit poster's website
gotcha
Regular
Regular


Joined: Mar 14, 2005
Posts: 70

PostPosted: Wed Sep 05, 2007 6:12 pm Reply with quote Back to top

You should call config.php first as it contains the info to connect to the db.
View user's profile Send private message Visit poster's website
Donovan
Client


Joined: Oct 07, 2003
Posts: 691
Location: Ohio

PostPosted: Thu Sep 06, 2007 7:19 am Reply with quote Back to top

Thanks.. I changed it and it did the trick.
View user's profile Send private message Visit poster's website ICQ Number
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1472
Location: In front of a screen....HELP! lol

PostPosted: Thu Sep 06, 2007 8:32 pm Reply with quote Back to top

Just for information Donovan, you must think of includes as a part of the script.

For example,

If I was to write a script like this:
index.php
Code:

<?php
include('info.php');
echo $info;
?>


And I made a script like this:

Code:

<?php
$info='hello';
?>


The output would be as you think, hello.

But in the end, you must think of index.php written like this:

Code:

<?php

$info='hello';
echo $info;
?>


It may not be perfect, but it is how I think of it and I think it's rather easy to remember.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum