Skip to content

Instantly share code, notes, and snippets.

@DavidBruchmann
Created September 23, 2021 15:13
Show Gist options
  • Save DavidBruchmann/37a6ef5ce12386e991042e61349bce60 to your computer and use it in GitHub Desktop.
Save DavidBruchmann/37a6ef5ce12386e991042e61349bce60 to your computer and use it in GitHub Desktop.
TYPO3 emergency
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
// Exit early if php requirement is not satisfied.
if (PHP_VERSION_ID < 70400 || PHP_VERSION_ID >= 90000) {
die('This version of TYPO3 CMS requires PHP >= 7.4 and < 9.0');
}
$debug = 1; //false;
// Set up the application for the frontend
call_user_func(function () {
$classLoader = require dirname(__DIR__).'/protected/vendor/autoload.php';
chdir(getenv('TYPO3_PATH_ROOT'));
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(0, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_FE);
if ($debug) {
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump([$classLoader, getenv('TYPO3_PATH_ROOT'), \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::class]);
}
try {
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader)->get(\TYPO3\CMS\Frontend\Http\Application::class)->run();
}
catch(\Exception $e) {
if ($debug) {
echo $e->getMessage();
}
}
});
@DavidBruchmann
Copy link
Author

DavidBruchmann commented Sep 23, 2021

Reasons for using this file:

  • wrong settings in $GLOBALS['TYPO3_CONF_VARS']
  • missing access rights for folders or files
  • missing writing rights for folders or files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment