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)) {
|
||||
$_SERVER['SCRIPT_FILENAME'] = $candidate;
|
||||
$_SERVER['SCRIPT_NAME'] = str_replace($sitePath, '', $candidate);
|
||||
$_SERVER['DOCUMENT_ROOT'] = $sitePath;
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
|
||||
$fixedCandidates = [
|
||||
$this->asRootPhpIndexFile($sitePath),
|
||||
$this->asPublicPhpIndexFile($sitePath),
|
||||
$this->asPublicHtmlIndexFile($sitePath),
|
||||
$fixedCandidatesAndDocroots = [
|
||||
$this->asRootPhpIndexFile($sitePath) => $sitePath,
|
||||
$this->asPublicPhpIndexFile($sitePath) => $sitePath . '/public',
|
||||
$this->asPublicHtmlIndexFile($sitePath) => $sitePath . '/public',
|
||||
];
|
||||
|
||||
foreach ($fixedCandidates as $candidate) {
|
||||
foreach ($fixedCandidatesAndDocroots as $candidate => $docroot) {
|
||||
if ($this->isActualFile($candidate)) {
|
||||
$_SERVER['SCRIPT_FILENAME'] = $candidate;
|
||||
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
||||
$_SERVER['DOCUMENT_ROOT'] = $docroot;
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user