I want to determine if the PHP file I am on install.php is in a subdomain/subdirectory (basically not at domain.com/install.php).
see below
Use dirname($_SERVER['SCRIPT_NAME']) to get the directory portion of the URI.
Your syntax error is because you are missing the ; at the end of $scriptname="install.php".
Your method looks like it should work okay.
Another way you could determine if the file is installed at the domain root instead of a folder or subdomain would be something like this:
function subdomboolcheck()
{
    $root = $_SERVER['DOCUMENT_ROOT'];
    $filePath = dirname(__FILE__);
    if ($root == $filePath) {
        return false; // installed in the root
    } else {
        return true;  // installed in a subfolder or subdomain
    }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With