Tech Support Guy banner

require($_SERVER['DOCUMENT_ROOT'] help!

3469 Views 10 Replies 2 Participants Last post by  brendandonhu
Hey, I watched the 3D Buzz php&mysql series like 10 times. Love the tutorials.

I got apache php and mysql very easily set up but I am having a problem with require.

My php works when I do arithmetics, or date, or printing stuff but not with require. This code is an example from tutorials for practicing php.

$connection=mysql_connect($db_host, $db_user, $db_password) or die("error");

echo $db_host;

This is what I put, and theoretically it should print for me $db_host defined in config/config.php. But it doesn't. It doesn't show anything. Infact if I include this code with HTML documents, the HTML won't show either.

Has the syntax for document_root changed for later versions of PHP?

What is the problem? I even shut off my firewall etc. No good.

The only thing I can think of is my root is in C: so is my PHP folder, my apache and MySQL are in program files in their default places. maybe mysql_connect (); doesnt know where to look for the monitor? help please!
Not open for further replies.
1 - 6 of 11 Posts
yea I expected an error as well, but no error either. strange.
EDIT: actually it doesnt matter about the slashes.

it has a problem with the lines

$connection = mysql_connect($db_host, $db_user, $db_password) or die("error connecting");

when i add this into the code it screws up. not sure whats wrong with it.
is the function mysql_connect(); from PHP 5.2.0? I don't think it is included because when I add the mysql_connect to the code thats when nothing appears on the page. It doesn't interact with mysql on my computer.

EDIT: YUP my script is terminating at mysql_connect.' anything before it will print.

help me.
no wonder! how do I compile PHP with mysql?
1 - 6 of 11 Posts
Not open for further replies.