You can pull this information out of your MySQL database.
Because there is one standard database in MySQL that holds such.
The database name is information_schema.
Has got one table called GLOBAL_VARIABLES.
Of course, if you are on a hosted website, you can not do this.
You will not have access to the information_schema database.
Here is a script to get the path to MySQL basedirectory:
<?php
$db = mysql_connect('localhost','xxxxxx','xxxxxx');
if (!$db) {
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('information_schema', $db);
if (!$db_selected) {
die('Not selected : ' . mysql_error());
}
$var = 'BASEDIR';
$result = mysql_query("SELECT VARIABLE_VALUE FROM GLOBAL_VARIABLES WHERE VARIABLE_NAME='$var'");
$row = mysql_fetch_array($result);
if (!$row) {
die('No result : ' . mysql_error());
}
echo $var.': '.$row['VARIABLE_VALUE'];
?>