Antworten auf Ihre häufigsten Fragen

[cPanel] Wie lege ich ein PHP Error-Logging an?

English version below

Dieser Artikel richtet sich an Kunden mit einem cPanel Hosting Produkt.

Einrichtung PHP Error-Logging

Bei der Fehlerbehebung von PHP-Fehlern können Sie Ihre PHP-Protokolle überprüfen. Wenn Sie keine PHP-Protokolle zur Durchsicht haben, verwenden Sie den folgenden Prozess, um die Protokollierung einzurichten:

Das Error-Logfile sollte nur im Rahmen der Prüfung Ihrer Skripte und nicht dauerhaft aktiviert werden.
Die Deaktivierung ist beispielsweise durch die Umbenennung der im Nachfolgenden vorgestellten Datei möglich.
Ferner raten wir zur regelmäßigen Löschung des Error-Logfiles.

 Sie sollten immer ein Backup Ihrer Website erstellen, bevor Sie Änderungen an Ihrer Website vornehmen.

  • Suchen Sie Ihre PHP-Initialisierungsdatei (.user.ini) und editieren diese
  • Integrieren Sie die folgende Zeile in Ihrer Initialisierungsdatei:

error_log = /path/to/your/webroot/php_error.log

  • error_log ist die PHP-Funktion, die dem Webserver sagt, dass er Ihre Protokolle in eine neue Datei ausgeben soll.
  • /path/to/to/your/webroot/php_error.log ist der Pfad zu Ihrem neuen Protokoll.
    • Stellen Sie sicher, dass Sie /pfad/zu/ihrem/webroot durch den tatsächlichen Pfad ersetzen, den Sie verwenden.
    • für cPanel ist der Pfad: /home/username/public_html/
  • Erstellen Sie eine Datei mit dem Namen php_error.log im Webroot Ihres Hostings.
  • Beenden Sie die PHP-Prozesse

 

 

English version:

This article is aimed at customers with a cPanel hosting product.

Setting up PHP error logging

One of the ways to troubleshoot PHP errors is to review your PHP logs. If you don't have PHP logs to look through, use the following process to set up logging:

The error log file should only be activated in the context of checking your scripts and not permanently. Deactivation is possible, for example, by renaming the file presented below. We also recommend deleting the error log file regularly.

  • You should always back up your website before making any changes to your website.
  • Find your PHP initialization file (.user.ini) and edit it
  • Include the following line in your initialization file:

error_log = /path/to/your/webroot/php_error.log

  • error_log is the PHP function that tells the web server to output your logs to a new file.
  • /path/to/to/your/webroot/php_error.log is the path to your new log.
    • Make sure to replace /path/to/your/webroot dwith the actual path you are using.
    • for cPanel the path is: /home/username/public_html/
  • Create a file called php_error.log in the webroot of your hosting.
  • End the PHP processes


otto.friedrich@hosteurope.de xanthippe.ypsilante@hosteurope.de hercules.ikarus@hosteurope.de