83 public static function run(
int $entryPointLevel = 0,
int $requestType = self::REQUESTTYPE_FE)
87 self::setRequestType($requestType | ($requestType === self::REQUESTTYPE_BE && strpos($_REQUEST[
'route'] ??
'',
'/ajax/') === 0 ? TYPO3_REQUESTTYPE_AJAX : 0));
95 $applicationContext = static::createApplicationContext();
97 GeneralUtility::presetApplicationContext($applicationContext);
110 $applicationContext = getenv(
'TYPO3_CONTEXT') ?: (getenv(
'REDIRECT_TYPO3_CONTEXT') ?: (getenv(
'HTTP_TYPO3_CONTEXT') ?:
'Production'));
121 if (defined(
'TYPO3_version')) {
126 define(
'TYPO3_version',
'9.5.32-dev');
127 define(
'TYPO3_branch',
'9.5');
128 define(
'TYPO3_copyright_year',
'1998-' . date(
'Y'));
131 define(
'TYPO3_URL_GENERAL',
'https://typo3.org/');
132 define(
'TYPO3_URL_LICENSE',
'https://typo3.org/project/licenses/');
133 define(
'TYPO3_URL_EXCEPTION',
'https://typo3.org/go/exception/CMS/');
134 define(
'TYPO3_URL_DONATE',
'https://typo3.org/community/contribute/donate/');
135 define(
'TYPO3_URL_WIKI_OPCODECACHE',
'https://docs.typo3.org/m/typo3/guide-installation/master/en-us/Troubleshooting/Index.html#opcode-cache-messages');
138 define(
'TYPO3_URL_MAILINGLISTS',
'http://lists.typo3.org/cgi-bin/mailman/listinfo');
139 define(
'TYPO3_URL_DOCUMENTATION',
'https://typo3.org/documentation/');
140 define(
'TYPO3_URL_DOCUMENTATION_TSREF',
'https://docs.typo3.org/typo3cms/TyposcriptReference/');
141 define(
'TYPO3_URL_DOCUMENTATION_TSCONFIG',
'https://docs.typo3.org/typo3cms/TSconfigReference/');
142 define(
'TYPO3_URL_CONSULTANCY',
'https://typo3.org/support/professional-services/');
143 define(
'TYPO3_URL_CONTRIBUTE',
'https://typo3.org/contribute/');
144 define(
'TYPO3_URL_SECURITY',
'https://typo3.org/teams/security/');
145 define(
'TYPO3_URL_DOWNLOAD',
'https://typo3.org/download/');
146 define(
'TYPO3_URL_SYSTEMREQUIREMENTS',
'https://typo3.org/typo3-cms/overview/requirements/');
149 defined(
'LF') ?: define(
'LF', chr(10));
150 defined(
'CR') ?: define(
'CR', chr(13));
151 defined(
'CRLF') ?: define(
'CRLF', CR . LF);
154 defined(
'NUL') ?: define(
'NUL',
"\0");
155 defined(
'TAB') ?: define(
'TAB',
"\t");
156 defined(
'SUB') ?: define(
'SUB', chr(26));
159 define(
'FILE_DENY_PATTERN_DEFAULT',
'\\.(php[3-8]?|phpsh|phtml|pht|phar|shtml|cgi)(\\..*)?$|\\.pl$|^\\.htaccess$');
161 define(
'PHP_EXTENSIONS_DEFAULT',
'php,php3,php4,php5,php6,php7,php8,phpsh,inc,phtml,pht,phar');
165 defined(
'TYPO3_OS') ?: define(
'TYPO3_OS', self::getTypo3Os());
170 define(
'T3_ERR_SV_GENERAL', -1);
172 define(
'T3_ERR_SV_NOT_AVAIL', -2);
174 define(
'T3_ERR_SV_WRONG_SUBTYPE', -3);
176 define(
'T3_ERR_SV_NO_INPUT', -4);
178 define(
'T3_ERR_SV_FILE_NOT_FOUND', -20);
180 define(
'T3_ERR_SV_FILE_READ', -21);
182 define(
'T3_ERR_SV_FILE_WRITE', -22);
184 define(
'T3_ERR_SV_PROG_NOT_FOUND', -40);
186 define(
'T3_ERR_SV_PROG_FAILED', -41);
195 protected static function definePaths(
int $entryPointLevel,
int $requestType)
199 $scriptPath = GeneralUtility::fixWindowsFilePath(self::getPathThisScript($isCli));
202 if (getenv(
'TYPO3_PATH_ROOT')) {
208 $scriptName =
'/typo3/sysext/core/bin/typo3';
213 $scriptName = substr($scriptPath, strlen($rootPath));
215 $rootPath = GeneralUtility::fixWindowsFilePath(getenv(
'TYPO3_PATH_ROOT'));
216 $scriptPath = $rootPath . $scriptName;
219 if (!defined(
'PATH_thisScript')) {
221 define(
'PATH_thisScript', $scriptPath);
224 if (!defined(
'PATH_site')) {
226 define(
'PATH_site', $rootPath .
'/');
230 if (!defined(
'TYPO3_mainDir')) {
231 define(
'TYPO3_mainDir',
'typo3/');
235 if (!defined(
'PATH_typo3')) {
237 define(
'PATH_typo3', PATH_site . TYPO3_mainDir);
241 if (!defined(
'PATH_typo3conf')) {
243 define(
'PATH_typo3conf', PATH_site .
'typo3conf/');
252 if (!is_file(PATH_thisScript)) {
253 static::exitWithMessage(
'Unable to determine path to entry script.');
275 $GLOBALS[
'TYPO3_MISC'][
'microtime_start'] = microtime(
true);
296 $scriptPath = PATH_thisScript;
297 $sitePath = rtrim(PATH_site,
'/');
299 if (getenv(
'TYPO3_PATH_ROOT')) {
300 $rootPathFromEnvironment = GeneralUtility::fixWindowsFilePath(getenv(
'TYPO3_PATH_ROOT'));
301 if ($sitePath !== $rootPathFromEnvironment) {
305 $scriptPath = $rootPathFromEnvironment . substr($scriptPath, strlen($sitePath));
306 $sitePath = $rootPathFromEnvironment;
310 $projectRootPath = GeneralUtility::fixWindowsFilePath(getenv(
'TYPO3_PATH_APP'));
311 $isDifferentRootPath = ($projectRootPath && $projectRootPath !== $sitePath);
314 self::isCliRequestType($requestType),
315 self::usesComposerClassLoading(),
316 $isDifferentRootPath ? $projectRootPath : $sitePath,
318 $isDifferentRootPath ? $projectRootPath .
'/var' : $sitePath .
'/typo3temp/var',
319 $isDifferentRootPath ? $projectRootPath .
'/config' : $sitePath .
'/typo3conf',
321 self::getTypo3Os() ===
'WIN' ?
'WINDOWS' :
'UNIX'
336 error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED));
347 if (!stristr(PHP_OS,
'darwin') && !stristr(PHP_OS,
'cygwin') && stristr(PHP_OS,
'win')) {
386 if (isset($_SERVER[
'ORIG_PATH_TRANSLATED'])) {
387 $cgiPath = $_SERVER[
'ORIG_PATH_TRANSLATED'];
388 } elseif (isset($_SERVER[
'PATH_TRANSLATED'])) {
389 $cgiPath = $_SERVER[
'PATH_TRANSLATED'];
391 if ($cgiPath && in_array(PHP_SAPI, self::$supportedCgiServerApis,
true)) {
392 $scriptPath = $cgiPath;
394 if (isset($_SERVER[
'ORIG_SCRIPT_FILENAME'])) {
395 $scriptPath = $_SERVER[
'ORIG_SCRIPT_FILENAME'];
397 $scriptPath = $_SERVER[
'SCRIPT_FILENAME'];
414 if (isset($_SERVER[
'argv'][0])) {
415 $scriptPath = $_SERVER[
'argv'][0];
416 } elseif (isset($_ENV[
'_'])) {
417 $scriptPath = $_ENV[
'_'];
419 $scriptPath = $_SERVER[
'_'];
422 $isRelativePath =
false;
423 if (self::getTypo3Os() ===
'WIN') {
424 if (!preg_match(
'/^([a-zA-Z]:)?\\\\/', $scriptPath)) {
425 $isRelativePath =
true;
428 if ($scriptPath[0] !==
'/') {
429 $isRelativePath =
true;
433 if ($isRelativePath) {
434 if (isset($_SERVER[
'PWD'])) {
435 $workingDirectory = $_SERVER[
'PWD'];
437 $workingDirectory = getcwd();
439 $scriptPath = $workingDirectory .
'/' . preg_replace(
'/\\.\\//',
'', $scriptPath);
462 if ($entryPointLevel > 0) {
463 list($rootPath) = GeneralUtility::revExplode(
'/', $entryScriptDirectory, $entryPointLevel + 1);
465 $rootPath = $entryScriptDirectory;
479 'Content-Type: text/plain'
481 if (!headers_sent()) {
482 foreach ($headers as $header) {
498 if (static::$disabledFunctions ===
null) {
499 static::$disabledFunctions = GeneralUtility::trimExplode(
',', ini_get(
'disable_functions'));
501 if (!empty(static::$disabledFunctions)) {
502 return in_array($function, static::$disabledFunctions,
true);
513 return defined(
'TYPO3_COMPOSER_MODE') && TYPO3_COMPOSER_MODE;
522 if (defined(
'TYPO3_REQUESTTYPE_FE')) {
525 define(
'TYPO3_REQUESTTYPE_FE', self::REQUESTTYPE_FE);
526 define(
'TYPO3_REQUESTTYPE_BE', self::REQUESTTYPE_BE);
527 define(
'TYPO3_REQUESTTYPE_CLI', self::REQUESTTYPE_CLI);
528 define(
'TYPO3_REQUESTTYPE_AJAX', self::REQUESTTYPE_AJAX);
529 define(
'TYPO3_REQUESTTYPE_INSTALL', self::REQUESTTYPE_INSTALL);
539 if (defined(
'TYPO3_REQUESTTYPE')) {
542 define(
'TYPO3_REQUESTTYPE', $requestType);
552 if (defined(
'TYPO3_MODE')) {
555 define(
'TYPO3_MODE', $mode);
567 if ($requestType ===
null) {