PHP and subdomain - Im getting a little confused

Associate
Joined
20 May 2007
Posts
441
Hey everyone,

On my site I tend to use php just to make sure the menu and footer is the same by all the my pages reading from one place.

Anyway I just started playing around with making subdomains, I thought when I make a directory in my root folder a subdomain, the folder became root for all sites in that folder. This holds for my css file in a folder.

But when I put the script

Code:
<?php
    require_once("/php/menu.php");
?>

in the index page, it produces an error

Code:
Warning: require_once(/php/menu.php) [function.require-once]: failed to open stream: No such file or directory in /home/gauntfac/public_html/tutorials/index.php on line 13

Fatal error: require_once() [function.require]: Failed opening required '/php/menu.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gauntfac/public_html/tutorials/index.php on line 13

I can fix this by removing the first / in /php/menu.php but I don't see why this doesn't work, is there some setting I need to change in cPanel to make this work? I'm tsohost if that helps at all

Gaunt
 
Php will process from the root of the server, so the file would need to be linked from there, which will probably be something like:

/home/username/public_html/php/menu.php
 
Back
Top Bottom