I’ve inherited a site from a developer and they’re using the following function to set the document root and define the mysql_connection for the site I assume:
function construct()
{
$this->mysql_link = mysql_connect("the_host", "username", "password");
mysql_select_db("thedatabase", $this->mysql_link);
$this->rootDir = $_SERVER['DOCUMENT_ROOT']."admin/";
$this->templateDir = $this->rootDir."templates/";
$this->isAdmin();
}
The trouble is, when I try to run this on my local development platform (Mac OSX Lion/PHP/Mysql) I keep getting the following error:
Warning: include(/Library/WebServer/Documentsadmin/templates/index/In The News/item.php) [function.include]: failed to open stream: No such file or directory in /Users/mycomputername/Sites/thewebsite.com/admin/editable.class.php on line 283
I’m relatively new to PHP and I’m assuming there’s a problem with my php.ini file pointing to the wrong place as the web root but I’m not sure how to fix that or if that’s even the problem I’m experiencing.
The database connection is functioning properly though.
Any help in diagnosing this is greatly appreciated.
Why not set rootDir to
instead? (add some more dirname()s around it if you need a higher level).
Assuming of course that the rootDir you need is somehow related to this file.