Skip to content

Commit 1f6761b

Browse files
committed
refactor: move SAPI check up
1 parent e2e94e8 commit 1f6761b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

spark

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
* this class mainly acts as a passthru to the framework itself.
2222
*/
2323

24+
// Refuse to run when called from php-cgi
25+
if (strpos(PHP_SAPI, 'cgi') === 0) {
26+
exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
27+
}
28+
2429
/**
2530
* @var bool
2631
*
@@ -43,11 +48,6 @@ define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR)
4348
// Ensure the current directory is pointing to the front controller's directory
4449
chdir(FCPATH);
4550

46-
// Refuse to run when called from php-cgi
47-
if (strpos(PHP_SAPI, 'cgi') === 0) {
48-
exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
49-
}
50-
5151
// This is the line that might need to be changed, depending on your folder structure.
5252
$pathsConfig = FCPATH . '../app/Config/Paths.php';
5353
// ^^^ Change this line if you move your application folder

0 commit comments

Comments
 (0)