mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Set DOCUMENT_ROOT when serving index.php files.
This commit is contained in:
@@ -54,20 +54,22 @@ public function frontControllerPath($sitePath, $siteName, $uri)
|
|||||||
if ($this->isActualFile($candidate)) {
|
if ($this->isActualFile($candidate)) {
|
||||||
$_SERVER['SCRIPT_FILENAME'] = $candidate;
|
$_SERVER['SCRIPT_FILENAME'] = $candidate;
|
||||||
$_SERVER['SCRIPT_NAME'] = str_replace($sitePath, '', $candidate);
|
$_SERVER['SCRIPT_NAME'] = str_replace($sitePath, '', $candidate);
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] = $sitePath;
|
||||||
return $candidate;
|
return $candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fixedCandidates = [
|
$fixedCandidatesAndDocroots = [
|
||||||
$this->asRootPhpIndexFile($sitePath),
|
$this->asRootPhpIndexFile($sitePath) => $sitePath,
|
||||||
$this->asPublicPhpIndexFile($sitePath),
|
$this->asPublicPhpIndexFile($sitePath) => $sitePath . '/public',
|
||||||
$this->asPublicHtmlIndexFile($sitePath),
|
$this->asPublicHtmlIndexFile($sitePath) => $sitePath . '/public',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($fixedCandidates as $candidate) {
|
foreach ($fixedCandidatesAndDocroots as $candidate => $docroot) {
|
||||||
if ($this->isActualFile($candidate)) {
|
if ($this->isActualFile($candidate)) {
|
||||||
$_SERVER['SCRIPT_FILENAME'] = $candidate;
|
$_SERVER['SCRIPT_FILENAME'] = $candidate;
|
||||||
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] = $docroot;
|
||||||
return $candidate;
|
return $candidate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user