Yes, there is such an alternative. You must use an absolute path using the realpath function
The index.php file, which is used by default in CMS Drupal:
define('DRUPAL_ROOT', getcwd());
The index.php file, which is used by default in CMS Drupal:
$drupaldir = realpath('/var/www/vhosts/yourdomain/httpdocs');
define('DRUPAL_ROOT', $drupaldir);