20 Most Common TYPO3 Errors (And How to Fix Them)

No matter, either you are a beginner or experienced TYPO3 developer, It’s always good to improve your TYPO3 error and debugging handling skills to get quality and productive work. Here are some tips, tricks, and tools to handle TYPO3 errors.

20 Most Common TYPO3 Errors (And How to Fix Them)

No matter, either you are a beginner or experienced TYPO3 developer, It’s always good to improve your TYPO3 error and debugging handling skills to get quality and productive work. Here are some tips, tricks, and tools to handle TYPO3 errors.

Error in TYPO3 by either system or human-based, It’s sometimes difficult to find out what, where, and how to fix TYPO3 errors. Imagine, your customer's TYPO3 site suddenly stopped by saying “Oops and an error occurred” one of the famous TYPO3 error messages If you have a bit of experience how TYPO3 error handling works then you will be able to fix it hassle-free.

In this blog article, I would like to write tips, tricks, and tools to find errors in TYPO3 from beginners to advanced TYPO3 users and developers.

Software is written by humans and therefore has bugs & errors. - John Jacobs

How to Enable TYPO3 Display Error?

Before you start the TYPO3 development, Make sure to enable the TYPO3 display error as below.

// typo3conf/LocalConfiguration.php

// Do not display any PHP error messages.
$TYPO3_CONF_VARS['SYS']['displayErrors'] = '0'; 

// Display error messages with the registered error handler
$TYPO3_CONF_VARS['SYS']['displayErrors'] = '1'; 

// Default setting. If devIPmask matches the users IP address
$TYPO3_CONF_VARS['SYS']['displayErrors'] = '-1';

What Are Best Practices TYPO3 Errors Handling?

In Modern TYPO3 Development, Developers are more focusing on the CI/CD development model. So, You will always work on a single TYPO3 Instance by the configuration of multiple TYPO3 environments.

Based on your every TYPO3 environment like local-development, staging server and production live TYPO3 site, You should consider setting best practices TYPO3 error handling.

Step 1. Create TYPO3_Context server variable through SetEnv

SetEnv TYPO3_CONTEXT Development

Step 2. Prepare TYPO3 Environment your each TYPO3_CONTEXT

# Set context with mod_rewrite
# Rules to set ApplicationContext based on hostname
RewriteCond %{HTTP_HOST} ^dev\.example\.com$
RewriteRule .? - [E=TYPO3_CONTEXT:Development]

RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule .? - [E=TYPO3_CONTEXT:Production]

Tips: For CLI-based, You can easily configure TYPO3_CONTEXT

export TYPO3_CONTEXT=Development
env | grep TYPO3_CONTEXT
TYPO3_CONTEXT=Development ./typo3/cli_dispatch.phpsh

Step 3. Configure TYPO3 Error Handling for each TYPO3 Context Environment. Create /typo3conf/AdditionalConfiguration.php

<?php
// typo3conf/AdditionalConfiguration.php

// Let's find out TYPO3_CONTEXT
switch (\TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext()) {
    
    // Error Handeling for Production or Staging server
    case 'Production':
        $GLOBALS['TYPO3_CONF_VARS']['SYS'] => array(
            'displayErrors' => '0',
            'devIPmask' => '',
            'errorHandler' => '',
            'debugExceptionHandler' => '',
            'productionExceptionHandler' => '',
            'syslogErrorReporting' => '0',
            'belogErrorReporting' => '0',
        );

    // Error Handeling for Local Server
    default:
        $GLOBALS['TYPO3_CONF_VARS']['SYS'] => array(
            'displayErrors' => '1',
            'devIPmask' => '*',
            'errorHandler' => 'TYPO3\\CMS\\Core\\Error\\ErrorHandler',
            'errorHandlerErrors' => E_ALL ^ E_NOTICE,
            'exceptionalErrors' => E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING,
            'debugExceptionHandler' => 'TYPO3\\CMS\\Core\\Error\\DebugExceptionHandler',
            'productionExceptionHandler' => 'TYPO3\\CMS\\Core\\Error\\DebugExceptionHandler',
        );
}

Step 4. Configure PHP & TypoScript Setting

For Local TYPO3 Development

// In .htaccess or php.ini
php_flag display_errors on
php_flag log_errors on
php_value error_log /path/to/php_error.log

// In TypoScript Setup
config.contentObjectExceptionHandler = 0

For Live Production TYPO3 Environment

// In .htaccess or php.ini
php_flag display_errors off
php_flag log_errors on
php_value error_log /path/to/php_error.log

// In TypoScript Setup
config.contentObjectExceptionHandler = 1

What are the ways to check TYPO3 Error Logs?

You can check the TYPO3 errors log in many ways as below.

Option #1

Web server log files for general problems (e.g. /var/log/apache2 on Linux based system)

Option #2

TYPO3 Administration log in SYSTEM > Log (in the backend)

Option #3

TYPO3 logs writing by Logging Framework in typo3temp/var/log

TYPO3 Oops an error occurred!

For a long time, with TYPO3 6.0 there is the ApplicationContext in TYPO3, that allows you to run TYPO3 in the various modes such as Productive, Development, or Testing

TYPO3 runs in a Productive mode with no condition factors set. In this mode, no special cases might be given to the site visitors, since website hackers can spy out data about the framework in these alleged backtraces. The ContentObjectExceptionHandler has been incorporated to forestall this useful information. If an exception is thrown during the handling of content elements, and this incorporates every single front extension, this ExceptionHandler gets it and just reports with the words

Oops, an error occurred, Oops, I can't do anything with the mistake ... but what to do?

Don't panic - it's not that bad! There is a simple way to get the error message such as: "Oops, an error occurred! Code: 2017042520255025e4885c “to debug. The procedure is still the same with TYPO3 9.5.x.

Solution #1 Check the system log files

One possibility is to open the log file and search for the error code. It looks something like this:

// You can find the file at:
typo3temp/logs/typo3_[abc123].log

// or with newer TYPO3 versions under:
typo3temp/var/logs/typo3_[abc123].log

Here we can read out what it is, but this method is not particularly comfortable.

Solution #2 Enable TYPO3 Display Error

// TypoScript Setup
config.contentObjectExceptionHandler = 0

The ContentObjectExceptionHandler can be configured very individually using TypoScript. The ExceptionHandler can also be switched off completely in the productive mode for the time of development.

If you ADDITIONALLY set the "Configuration Preset" to "Debug" in the install tool, then the well-known backtraces will appear again in the frontend:

TYPO3 <= v8.x

TYPO3 >= 9.x

On the off chance that you set the ExceptionHandler to 1 (or reset the setting totally), you activate the standard-setting, and "Oops, an error occurred!" would be shown again in the frontend. 

Anyways, you can always alter this content utilizing another TypoScript setting:

// TypoScript Setup
config.contentObjectExceptionHandler = 1
config.contentObjectExceptionHandler.errorMessage = Oh Sorry Dear, It does not work, Contact system administrator %s

Do you want to custom TYPO3 Error Handle?

TYPO3 provides a custom TYPO3 Error handler feature to make it personalization according to your needs eg., with your TYPO3 custom extension.

// ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandler'] = \Vendor\Ext\Error\MyOwnErrorHandler::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] = \Vendor\Ext\Error\MyOwnDebugExceptionHandler::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] = \Vendor\Ext\Error\MyOwnProductionExceptionHandler::class;

Let’s have a quick example of the TYPO3 Error handler.

// /typo3conf/ext/yourextension/Classes/Error/PostExceptionsOnTwitter.php
namespace Vendor\Ext\Error;

class PostExceptionsOnTwitter extends \TYPO3\CMS\Core\Error\DebugExceptionHandler
{
    public function echoExceptionWeb(Exception $exception)
    {
        $this->postExceptionsOnTwitter($exception);
    }

    public function postExceptionsOnTwitter($exception)
    {
        // do it ;-)
    }
}

// ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] = \Vendor\Ext\Error\PostExceptionsOnTwitter::class;

How can I configure the 404 error page in TYPO3?

That’s very easy! Here is the TYPO3 version wise 404 error page configuration.

TYPO3 <= v8

// typo3conf/LocalConfiguration.php
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/index.php?id=12';
$TYPO3_CONF_VARS['FE']['pageNotFound_handling_statheader'] = 'HTTP/1.1 404 Not Found';

TYPO3 >= v9

Error handling can be configured on-site level and is automatically dependent on the current site and language.

Step 1. Go to Site Management > Sites

Step 2. Add/Edit your site record, Click on the “Error Handling” tab.

Step 3. Choose HTTP Error Status Code = 404, How to Handle Errors = Show Content From Page, and select your created 404 pages.

errorCode

The HTTP (Error) Status Code to handle. The predefined list contains the most common errors, a free definition of other error codes is also possible. Special value 0 will take care of all errors.

errorHandler

Define how to handle these errors. Maybe Fluid for rendering a fluid template, page for fetching content from a page, or PHP for a custom implementation.

Do you want a PHP-based Custom 404 error handler in TYPO3?

You can also configure PHP-based custom 404 error handling in TYPO3.

Step 1. Configure errorHandler=PHP into Site Management

// config.yaml
errorHandling:
  -
    errorCode: '404'
    errorHandler: PHP
    errorPhpClassFQCN: Vendor\Ext\Error\ErrorHandling

// /Classes/Error/ErrorHandling.php
<?php

namespace Ophi\Blog\Error;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerInterface;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Http\RedirectResponse;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use Ophi\Blog\Service\Debug;

class ErrorHandling implements PageErrorHandlerInterface{

    public function handlePageError(ServerRequestInterface $request, string $message, array $reasons = []): ResponseInterface{
        if(Debug::isTestServer()) {
            DebuggerUtility::var_dump($message);
            DebuggerUtility::var_dump($reasons);
            return new HtmlResponse('Diese Seite liefert einen 404 Error', 404);
        }
        return new RedirectResponse('/404-fehlerseite', 404);
    }
}

How to Solve 500 Internal Server Error in TYPO3?

There are lots of causes of TYPO3 500 internal server errors, But one common error is at the frontend while accessing your site due to Apache’s mod_rewrite.

# .Htacces
# mod_rewrite Enable
RewriteEngine On

# IMPORTANT: Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
RewriteBase /
# or
RewriteBase /yourfolder

How to solve “No TypoScript Template Found” in TYPO3?

Well tricky for beginners, That’s not an error :) It simply says, you did not configure your TypoScript Template :)

// Try TypoScript Setup from Web > Template > Root-page
page = PAGE
page.10 = TEXT
page.10.value = Hello TYPO3!

Deprecation log handling in TYPO3 9

The deprecation log is a handy feature of TYPO3 to learn what parts of your setup will not work anymore in future releases of TYPO3. In the recent version 9, there are important changes to the deprecation log and its handling.

TYPO3 <= v8

// typo3conf/LocalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog'] = ‘1’;

TYPO3 >= v9

// typo3conf/LocalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['LOG'] => [
    'TYPO3' => [
        'CMS' => [
            'deprecations' => [
                'writerConfiguration' => [
                    \TYPO3\CMS\Core\Log\LogLevel::NOTICE => [
                        \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
                            'disabled' => true,
                        ],
                    ],
                ],
            ],
        ],
    ],
],

But there is even a little more. The deprecation log has now been disabled by default.

In order to enable it, simply visit the Configuration Presets in the Install Tool and choose the development preset, or adjust your LocalConfiguration.php.

How to Solve SMTP Errors in TYPO3?

You need to make sure of the correct configuration of your SMTP server as below.

// typo3conf/LocalConfiguration.php
'transport' => 'smtp',
'transport_smtp_server' => 'your.smtp.provider:PORT',
'transport_smtp_encrypt' => 'TLS_OR_SSL',
'transport_smtp_username' => 'USERNAME@gmail.com',
'transport_smtp_password' => 'PASSWORD',
'transport_sendmail_command' => '',
'defaultMailFromAddress' => 'USERNAME@gmail.com',
'defaultMailFromName' => 'NAME',

How to Solve ImageMagick Configuration Errors?

Sometimes, Your server might have a different way of ImageMagick configuration eg., The most time error is due to where ImageMagick has been installed “im_path” and “img_path_lzw”.

While debugging ImageMagick, you can consider these properties of GFX.

// typo3conf/LocalConfiguration.php
$TYPO3_CONF_VARS['GFX']['TTFdpi'] = '96';
$TYPO3_CONF_VARS['GFX']['gdlib_2'] = '1';
$TYPO3_CONF_VARS['GFX']['noIconProc'] = '0';
$TYPO3_CONF_VARS['GFX']['imagefile_ext'] = 'gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai';
$TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = '1';
$TYPO3_CONF_VARS['GFX']['enable_typo3temp_db_tracking'] = '1';
$TYPO3_CONF_VARS['GFX']['im_path'] = '/usr/bin/';
$TYPO3_CONF_VARS['GFX']['imagefile_ext'] = 'gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai';
$TYPO3_CONF_VARS['GFX']['im_noScaleUp'] = '1';
$TYPO3_CONF_VARS['GFX']['png_truecolor'] = '1';
$TYPO3_CONF_VARS['GFX']['im_path_lzw'] = '/usr/bin/';
$TYPO3_CONF_VARS['GFX']['gif_compress'] = '1';
$TYPO3_CONF_VARS['GFX']['im_version_5'] = 'gm'; 
$TYPO3_CONF_VARS['SYS']['systemLocale'] = 'de_DE';

How can I solve Error caused by the TYPO3 extension installation?

TYPO3 beginners sometimes face such issues like trying to install TYPO3 extensions from TER, and suddenly cause fatal errors, You will not be able to access either Backend or Frontend. You will feel a bit helpless.

No worries, You can easily solve TYPO3 Errors with the below steps.

Error Solve in TYPO3 CMS 4.7.x

  • Step 1. Open typo3conf/localconf.php
  • Step 2. Find $TYPO3_CONF_VARS['EXT']['extList'] and remove the entry with the name of the extension at the end of the list. 
  • Step 3. After saving, the files, Make sure to remove temp_CACHED ... are deleted in the /typo3conf/ folder. Then the website and login should work again.

Error Solve in TYPO3 CMS 6.0

  • Step 1. Open typo3conf/LocalConfiguration.php
  • Step 2.  Here you look for the area 'extListArray' => array (...) and within this array remove the line with the name of the extension and save the file.
  • Step 3. I recommend removing the typo3temp/Cache directory.

Error Solve from TYPO3 CMS 6.2

  • Step 1. Open typo3conf/PackageStates.php.
  • Step 2. Search for the extension key here and change the status to inactive.
  • Step 3. I recommend removing the typo3temp/Cache directory.

How can I search for a TypoScript code error?

Hmm, PHP errors can be found easily, How can we know if something is wrong in TypoScript code?

Troubleshooting TypoScript can be a confusing process as there are numerous impacts like the active page and conditions. Additionally, constants can be utilized that get substituted. The accompanying segments provide data about how to debug TypoScript and how to discover errors inside TypoScript.

Analysis TYPO3 Constants

Step 1. Go to Web > Template > TypoScript Object Browser 

Step 2. Choose “Constant” from the Browse select box.

Analyze TypoScript Errors

Well, there are no tools available that will tell whether the given TypoScript code is 100% right. The TypoScript Object Browser will caution you about syntax errors, however:

Step 1. Go to Web > Template > TypoScript Object Browser 

Step 2. Choose “Setup” from Brows select box.

Find TypoScript Error in Template Analyzer

Step 1. Go to Web > Template > Template Analyzer

Step 2. Click on “View the complete TS Listing”

It will render the whole TypoScript which has been set up with a line number and try to TypoScript errors (if any).

By d way, In Frontend, the Admin Panel is another possibility to debug TypoScript; use its section called “TypoScript”. It shows selected rendered (configuration) values, SQL queries, error messages, and more.

// TypoScript Setup
config.admPanel = 1

How to solve Fatal error: Allowed memory size bytes exhausted in TYPO3?

In TYPO3 or any PHP based website, Suddenly you might get “allowed memory size” error eg.,

Fatal error: Allowed memory size of 278347977 bytes exhausted (tried to allocate 95 bytes) in /typo3/sysext/core/Classes/Database/DatabaseConnection.php on line 1038.

In such a situation with TYPO3 CMS - Contact your server administrator to improve server performance. For a quick solution, You can try below.

  • Go to Admin Tools > Maintenance > Flush Cache
  • Try to remove /typo3temp/ folder
  • Go to Admin Tools > Maintenance > Remove Temporary Assets
  • Under Admin Tools ›Users› create a new backend user and delete the old user.
  • In LocalConfiguration.php $TYPO3_CONF_VARS['SYS']['lockingMode'] = 'disable';
  • In LocalConfiguration.php $TYPO3_CONF_VARS['SYS']['setMemoryLimit'] = '16M';

Useful TYPO3 Error Extensions

TYPO3 core is already enough to find TYPO3 Errors and debugging, Apart from there, I’ve researched some of the popular TYPO3 extensions for error and debugging as below, I hope it will help you.

EXT:pagenotfoundhandling Advanced Page not found handling in TYPO3

Since TYPO3 v9, TYPO3 Core already provides a good error-handling using the Site Management backend module.

Team Agentur am Wasser developed a cool TYPO3 solution to manage advanced-level error handling. This extension implements a versatile Error Handler for the TYPO3 CMS Site Handling.

Features

  • Seamless integration with the TYPO3 Site Handling
  • Fetch and display any TYPO3 page in case of an error
  • Configuration of the request, that fetches the URL
  • Adjust TYPO3-internal language
  • Define additional GET query parameters (per Site and per errorCode)
  • Automatically manage authentication (HTTP Basic authentication [RFC 2617] / TYPO3 Frontend User Authentication)
  • Data collection (can be disabled)
  • Analysis backend module (still experimental)

EXT:typo3-config-handling Extended TYPO3 Configuration Handling

Helhum the TYPO3 man developed one “TYPO3 Config Handling” tool to improve site management and error handling.

One of the main goals is to configure multiple config.yaml based on your every TYPO3_CONTEXT environment.

Features

  • Settings depending on the environment
  • Configuration files in other formats
  • Configuration files stored in the config folder
  • Enhanced site configuration
  • Encrypting values in configuration files
  • Migrating your TYPO3 project to use TYPO3 Config Handling
// Default layout
{
    "extra": {
        "helhum/typo3-config-handling": {
            "settings": "config/settings.yaml",
            "dev-settings": "config/dev.settings.yaml",
            "override-settings": "config/override.settings.yaml",
            "install-steps": "config/setup/install.steps.yaml"
        }
    }
}

// Another Example to match the Symfony framework
{
    "extra": {
        "helhum/typo3-config-handling": {
            "settings": "config/config_prod.yaml",
            "dev-settings": "config/config_dev.yaml"
        }
    }
}

EXT:includekrexx Let’s Debug TYPO3 Fluid Errors

If you want to try different Debugger rather then TYPO3’s default also an interesting thing to debug TYPO3 Fluid Template, Team Brainworxx created kreXX is an element rich PHP debugger, highlighting backend access to log files, code building to arrive at the showed qualities, and significantly more.

EXT:t3helpers TYPO3 Helpers

Partners for Extbase: Simple and simple features that make your TYPO3 existence with extbase and extension development simpler. Kindly let me know whether you have any thoughts or on the off chance that you discover any mistakes, I will fix this right away.

EXT:pxa_lpeh Local Page Error Handler

Speed up error page takes care of and opens up PHP workers by stacking local page content without giving an outside HTTP request.

EXT:mklog MK Logging

Monitors developer logs. Gives programmed email alerts about significant errors.

EXT:fh_debug Debug generator and Devlog

This creates a PHP debug output document. What's more, this is a sys_log and devLog data logger.

EXT:debug_mysql_db Debug MySQL Database

Extends \TYPO3\CMS\Core\Database\DatabaseConnection (former t3lib_db) and \TYPO3\CMS\Core\Database\Connection to show Errors and Debug-Messages. Useful for viewing and debugging of SQL-queries. Shows error messages if they occur.

EXT:js_logger JavaScript TYPO3 Logger

This extension basically logs any javascript mistakes experienced in your frontend by means of ajax to the TYPO3 backend. It does this by utilizing the PSR\Log\LoggerInterface, so error logs are consequently sent to the Logger that is arranged in your TYPO3 instance. (like FileWriter or SysLogWriter)

EXT:zabbix_client Zabbix TYPO3

Zabbix is an open-source monitoring programming tool for assorted IT elements, including systems, servers, virtual machines, and cloud administrations. Customer for the Zabbix monitoring tool. Secure up your TYPO3 Systems and recognize errors and performance degraders.

How to make TYPO3 logs into a Dedicated Log File?

Instantiation of Loggers is configuration-free, as the LogManager automatically applies its configuration.

The Logger configuration is read from $GLOBALS['TYPO3_CONF_VARS']['LOG'], which contains an array reflecting the namespace and class hierarchy of your TYPO3 project.

Writer Configuration with FileWriter

// typo3conf/LocalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'] = [
    // configuration for ERROR level log entries
    \TYPO3\CMS\Core\Log\LogLevel::ERROR => [
        // add a FileWriter
        \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
            // configuration for the writer
            'logFile' => \TYPO3\CMS\Core\Core\Environment::getVarPath() . '/log/typo3_7ac500bce5.log'
        ]
    ]
];

Writer Configuration with SyslogWriter

// typo3conf/LocalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Documentation']['Examples']['Controller']['writerConfiguration'] = [
    // configuration for WARNING severity, including all
    // levels with higher severity (ERROR, CRITICAL, EMERGENCY)
    \TYPO3\CMS\Core\Log\LogLevel::WARNING => [
        // add a SyslogWriter
        \TYPO3\CMS\Core\Log\Writer\SyslogWriter::class => [],
    ],
];

Writer Configuration for Particular Extension

For extension “foo” with key “tx_foo” (not using namespaces), the configuration would be located at:

// typo3conf/LocalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Tx']['Foo']['writerConfiguration'] = [
   // ...
];

Processor Configuration

// typo3conf/LocalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Documentation']['Examples']['Controller']['processorConfiguration'] = [
    // configuration for ERROR level log entries
    \TYPO3\CMS\Core\Log\LogLevel::ERROR => [
        // add a MemoryUsageProcessor
        \TYPO3\CMS\Core\Log\Processor\MemoryUsageProcessor::class => [
            'formatSize' => TRUE
        ]
    ]
];

TYPO3 Logging

TYPO3 has a great logging system in-build in the core. It gives you endless possibilities to write and extend system logging features.

Instantiate a Logger for the Current Class

Method 1

/** @var $logger \TYPO3\CMS\Core\Log\Logger */
$this->logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger(__CLASS__);
$this->logger->info('entered function myFunction');

Method 2

declare(strict_types = 1);
namespace TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;

class GeneralUtilityMakeInstanceInjectLoggerFixture implements LoggerAwareInterface
{
    use LoggerAwareTrait;

   protected function myFunction() {
        $this->logger->info('entered function myFunction');
        $this->logger->warning('Something went awry, check your configuration!');
        $this->logger->error(
        'This was not a good idea',
            array(
                'foo' => $bar,
                'bar' => $foo,
            )
        );
        $this->logger->log(
            \TYPO3\CMS\Core\Log\LogLevel::CRITICAL,
            'This is an utter failure!'
        );
   }
}

Log Writers

The purpose of a log writer is (usually) to save all log records into persistent storage, like a log file, a database table, or to a remote Syslog server.

Built-in Log Writers

DatabaseWriter

The database writer logs into a database table. This table has to reside in the database used by TYPO3 and is not automatically created.

# ext_tables.sql
CREATE TABLE tx_myextname_log (
        request_id varchar(13) DEFAULT '' NOT NULL,
        time_micro double(16,4) NOT NULL default '0.0000',
        component varchar(255) DEFAULT '' NOT NULL,
        level tinyint(1) unsigned DEFAULT '0' NOT NULL,
        message text,
        data text,
        KEY request (request_id)
);

Tips

You can use this TYPO3 extension to see logs.

FileWriter

The file writer logs into a log file, one log record per line. If the log file does not exist, it will be created (including parent directories, if needed).

PhpErrorLogWriter

Logs into the PHP error log using error_log()

SyslogWriter

Logs into the Syslog (Unix only).

How to PHP & TYPO3 Debug?

I’ll write down a separate blog on TYPO3 Debug. For now, Let’s have a quick overview.

If you use PHP or you find yourself “adopting” a PHP, you must know how to debug PHP. Keep learning and improving your error handling and debugging skills into PHP & TYPO3.

  • Outputting values
  • Dumping variables to stdout
  • Switching error reporting level
  • Monitoring error logs
  • Stepping through code

PHP TYPO3 Debugging Tools

The TYPO3 Core provides a simple debug() (defined in EXT:core/Classes/Core/GlobalDebugFunctions.php).

It wraps around \TYPO3\CMS\Core\Utility\DebugUtility::debug()

debug($solr);

Debugging with Xdebug

The utilization of debuggers in other programming languages is default while it is unique in PHP: The most PHP designer keeps up bug fixing with e.g., echo and var_dump in the source code for understanding the routine. In spite of the fact that it's useful to utilize a genuine debugger to comprehend errors since you can experience the source code bit by bit and look at inner variables.

// Install Xdebug for TYPO3
sudo app-get install xdebug

// php.ini
zend_extension="/usr/local/php/modules/xdebug.so"

// php.ini
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

Install Xdebug Browser Plugin

Install plugin “Xdebug Helper” for your browser. To start debugging, click on the bug icon and select “Debug”.

Install Xdebug To Your Favorite PHP IDE

I highly recommend installing Xdebug into your favorite PHP Editor like VS, PHPStorm, Sublime, etc., Keep practicing and improving debugging skills to get better quality and productive TYPO3 work.

Wrapping-up!

Thanks for reading!

To find an all-in-one place, I've tried my best to cover all topics related to "TYPO3 Errors", I hope you find it useful. Let's have a quick recap on important topics.

  • Learn the basics of TYPO3 Error like enable TYPO3 display error, basic to advanced configuration of TYPO3 Error, etc.,
  • Keep exploring the system error log to understand what, where and how TYPO3 Errors are logged into the system.
  • Get used to of some common TYPO3 Error as Oops error occurred, 404 error, 500 server error, etc.,
  • Explore all mentioned Free TYPO3 Error extensions, Install and configure whichever you feel useful for your TYPO3 site.
  • If you are a TYPO3 extension developer then improve advanced level TYPO3 Errors and debugging skills to save your time.

Do you know any missing TYPO3 Error tips or techniques? Do you want any help for your any TYPO3 Errors? Feel free to write down to the comment box.

Have a Peaceful TYPO3 Error Handling :)

Post a Comment

×
  • user
    Mario Schwartz 2023-07-14 at 12:19 pm
    I'm so grateful for this blog post!
  • user
    David Beyer 2023-07-14 at 9:31 am
    This blog post is a lifesaver for TYPO3 beginners like me. I was struggling with a few of these errors, and I couldn't find a straightforward solution anywhere else. The author does an excellent job of explaining the root causes and providing easy-to-follow fixes.
  • user
    Tobias Gülzow 2020-08-28 at 2:18 pm
    Hi everyone.

    Thanks for recommending our little extension includekrexx.
    I really appreciate this.

    Sadly, I think there is a small little mistake in your article.
    The fluid part of the debugger was not written by Nitsan, it was written by Brainworxx.

    Tobi
    • user
      Sanjay Chauhan 2020-08-28 at 4:36 pm
      Hey Tobi,

      Thanks for your feedback and appreciation. Aha, that was our typo mistake which is just corrected now ;) Thanks to you guys for the contribution of your lovely TYPO3 extension, TYPO3 Community appreciate your efforts, Keep it up!

      Cheers,
      Sanjay
  • user
    Kristin Abend 2020-07-10 at 2:44 pm
    Oh nice, I just started building my TYPO3 Website and that would obviously call for lot of errors haha. I hope this blog could be useful to find the solutions to the errors i face while building my website
    • user
      Sanjay 2020-07-10 at 3:00 pm
      Dear Kristin Abend, Thanks for your kind words and appreciation. I'm happy you liked our TYPO3 blog.