Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php
Show All 9 Lines | public function isPreflightCheck() { | ||||
return true; | return true; | ||||
} | } | ||||
protected function executeChecks() { | protected function executeChecks() { | ||||
$version = phpversion(); | $version = phpversion(); | ||||
if (version_compare($version, 7, '>=') && | if (version_compare($version, 7, '>=') && | ||||
version_compare($version, 7.1, '<')) { | version_compare($version, 7.1, '<')) { | ||||
$message = pht( | $message = pht( | ||||
'You are running PHP version %s. Phabricator does not support PHP '. | 'You are running PHP version %s. %s does not support PHP '. | ||||
'versions between 7.0 and 7.1.'. | 'versions between 7.0 and 7.1.'. | ||||
"\n\n". | "\n\n". | ||||
'PHP removed signal handling features that Phabricator requires in '. | 'PHP removed signal handling features that %s requires in '. | ||||
'PHP 7.0, and did not restore them until PHP 7.1.'. | 'PHP 7.0, and did not restore them until PHP 7.1.'. | ||||
"\n\n". | "\n\n". | ||||
'Upgrade to PHP 7.1 or newer (recommended) or downgrade to an older '. | 'Upgrade to PHP 7.1 or newer (recommended) or downgrade to an older '. | ||||
'version of PHP 5 (discouraged).', | 'version of PHP 5 (discouraged).', | ||||
$version); | $version, | ||||
PhabricatorPlatformSite::getName(), | |||||
PhabricatorPlatformSite::getName()); | |||||
$this->newIssue('php.version7') | $this->newIssue('php.version7') | ||||
->setIsFatal(true) | ->setIsFatal(true) | ||||
->setName(pht('PHP 7.0-7.1 Not Supported')) | ->setName(pht('PHP 7.0-7.1 Not Supported')) | ||||
->setMessage($message) | ->setMessage($message) | ||||
->addLink( | ->addLink( | ||||
'https://phurl.io/u/php7', | 'https://phurl.io/u/php7', | ||||
pht('Phabricator PHP 7 Compatibility Information')); | pht('Phabricator PHP 7 Compatibility Information')); | ||||
return; | return; | ||||
} | } | ||||
$safe_mode = ini_get('safe_mode'); | $safe_mode = ini_get('safe_mode'); | ||||
if ($safe_mode) { | if ($safe_mode) { | ||||
$message = pht( | $message = pht( | ||||
"You have '%s' enabled in your PHP configuration, but Phabricator ". | "You have '%s' enabled in your PHP configuration, but %s ". | ||||
"will not run in safe mode. Safe mode has been deprecated in PHP 5.3 ". | "will not run in safe mode. Safe mode has been deprecated in PHP 5.3 ". | ||||
"and removed in PHP 5.4.\n\nDisable safe mode to continue.", | "and removed in PHP 5.4.\n\nDisable safe mode to continue.", | ||||
'safe_mode'); | 'safe_mode', | ||||
PhabricatorPlatformSite::getName()); | |||||
$this->newIssue('php.safe_mode') | $this->newIssue('php.safe_mode') | ||||
->setIsFatal(true) | ->setIsFatal(true) | ||||
->setName(pht('Disable PHP %s', 'safe_mode')) | ->setName(pht('Disable PHP %s', 'safe_mode')) | ||||
->setMessage($message) | ->setMessage($message) | ||||
->addPHPConfig('safe_mode'); | ->addPHPConfig('safe_mode'); | ||||
return; | return; | ||||
} | } | ||||
Show All 30 Lines | foreach ($disable_options as $disable_option) { | ||||
if (!$functions) { | if (!$functions) { | ||||
$fatal = false; | $fatal = false; | ||||
} | } | ||||
} | } | ||||
if ($fatal) { | if ($fatal) { | ||||
$message = pht( | $message = pht( | ||||
"You have '%s' enabled in your PHP configuration.\n\n". | "You have '%s' enabled in your PHP configuration.\n\n". | ||||
"This option is not compatible with Phabricator. Remove ". | "This option is not compatible with %s. Remove ". | ||||
"'%s' from your configuration to continue.", | "'%s' from your configuration to continue.", | ||||
$disable_option, | $disable_option, | ||||
PhabricatorPlatformSite::getName(), | |||||
$disable_option); | $disable_option); | ||||
$this->newIssue('php.'.$disable_option) | $this->newIssue('php.'.$disable_option) | ||||
->setIsFatal(true) | ->setIsFatal(true) | ||||
->setName(pht('Remove PHP %s', $disable_option)) | ->setName(pht('Remove PHP %s', $disable_option)) | ||||
->setMessage($message) | ->setMessage($message) | ||||
->addPHPConfig($disable_option); | ->addPHPConfig($disable_option); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$overload_option = 'mbstring.func_overload'; | $overload_option = 'mbstring.func_overload'; | ||||
$func_overload = ini_get($overload_option); | $func_overload = ini_get($overload_option); | ||||
if ($func_overload) { | if ($func_overload) { | ||||
$message = pht( | $message = pht( | ||||
"You have '%s' enabled in your PHP configuration.\n\n". | "You have '%s' enabled in your PHP configuration.\n\n". | ||||
"This option is not compatible with Phabricator. Disable ". | "This option is not compatible with %s. Disable ". | ||||
"'%s' in your PHP configuration to continue.", | "'%s' in your PHP configuration to continue.", | ||||
$overload_option, | $overload_option, | ||||
PhabricatorPlatformSite::getName(), | |||||
$overload_option); | $overload_option); | ||||
$this->newIssue('php'.$overload_option) | $this->newIssue('php'.$overload_option) | ||||
->setIsFatal(true) | ->setIsFatal(true) | ||||
->setName(pht('Disable PHP %s', $overload_option)) | ->setName(pht('Disable PHP %s', $overload_option)) | ||||
->setMessage($message) | ->setMessage($message) | ||||
->addPHPConfig($overload_option); | ->addPHPConfig($overload_option); | ||||
} | } | ||||
$open_basedir = ini_get('open_basedir'); | $open_basedir = ini_get('open_basedir'); | ||||
if (strlen($open_basedir)) { | if (strlen($open_basedir)) { | ||||
// If `open_basedir` is set, just fatal. It's technically possible for | // If `open_basedir` is set, just fatal. It's technically possible for | ||||
// us to run with certain values of `open_basedir`, but: we can only | // us to run with certain values of `open_basedir`, but: we can only | ||||
// raise fatal errors from preflight steps, so we'd have to do this check | // raise fatal errors from preflight steps, so we'd have to do this check | ||||
// in two parts to support fatal and advisory versions; it's much simpler | // in two parts to support fatal and advisory versions; it's much simpler | ||||
// to just fatal instead of trying to test all the different things we | // to just fatal instead of trying to test all the different things we | ||||
// may need to access in the filesystem; and use of this option seems | // may need to access in the filesystem; and use of this option seems | ||||
// rare (particularly in supported environments). | // rare (particularly in supported environments). | ||||
$message = pht( | $message = pht( | ||||
"Your server is configured with '%s', which prevents Phabricator ". | "Your server is configured with '%s', which prevents %s ". | ||||
"from opening files it requires access to.\n\n". | "from opening files it requires access to.\n\n". | ||||
"Disable this setting to continue.", | "Disable this setting to continue.", | ||||
'open_basedir'); | 'open_basedir', | ||||
PhabricatorPlatformSite::getName()); | |||||
$issue = $this->newIssue('php.open_basedir') | $issue = $this->newIssue('php.open_basedir') | ||||
->setName(pht('Disable PHP %s', 'open_basedir')) | ->setName(pht('Disable PHP %s', 'open_basedir')) | ||||
->addPHPConfig('open_basedir') | ->addPHPConfig('open_basedir') | ||||
->setIsFatal(true) | ->setIsFatal(true) | ||||
->setMessage($message); | ->setMessage($message); | ||||
} | } | ||||
} | } | ||||
} | } |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0