Urgent.News

What's breaking now, across thousands of outlets.

Tech

Activer WP_DEBUG et lire debug.log sans casser le site en production

Un site qui plante sans rien dire est un site qui vous cache la réponse. WordPress la connaît, il refuse simplement de l'afficher, et c'est voulu : montrer une trace PHP à vos visiteurs révélerait vos chemins de fichiers et vos versions logicielles. Il existe un réglage qui écrit l'erreur dans un fichier au lieu de l'afficher. C'est celui-là qu'il faut, et pas l'autre. Les trois constantes, et…

Original French Read in English

WordPress can display a "planted site" with no warning, hiding the answer. It intentionally refuses to show the PHP trace to your visitors, revealing file paths and software versions. The setting to write errors to a file instead of displaying them is the one you need. The three constants in wp-config.php before the comment line are WP_DEBUG (true) to enable debug mode, WP_DEBUG_LOG (true) to write errors to wp-content/debug.log, and WP_DEBUG_DISPLAY (false) to display nothing to visitors.

The third constant is the most important in production, as it prevents WordPress from displaying errors at the top of your pages to clients and search engines. A growing debug.log file can saturate your hosting quota and be accessible to anyone on the web. To diagnose the issue, activate WP_DEBUG, generate an error, and check the created debug.log file.

Three key pieces of information are displayed: Fatal error for critical issues, Warning for less severe problems, and Notice for minor warnings. The file path after in shows whether the error is caused by a plugin (plugins), theme (themes), core (wp-includes, wp-admin), or the site itself. The thrown in line indicates the exact location where the error occurred, more reliable than the first line when the error traces through multiple files.

The middle stack trace shows the sequence of function calls leading to the error, helping identify the culprit. The most common message after an update is "Call to undefined function," meaning an extension is calling a function that no longer exists due to a recent WordPress or PHP version change. The solution is to update or replace the extension, not to fix the file.

After identifying the problem, set WP_DEBUG to false and delete the debug.log file, as it will not empty itself and retains information about your installation paths. If the trace points to a core file rather than an extension, do not modify it, as it is usually a symptom of something else and touching the core can break the next update.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

BOLA, the #1 API Vulnerability: a One-Line Fix and an A-B Test in Go and PHP

An invoicing application exposes an API : web addresses, or URLs, that other programs call to read or change invoices. Bob is logged in with his account.

  • BOLA (Broken Object Level Authorization) ranks as top API vulnerability in 2023
  • Fix involves single line of code checking user ownership of invoice
  • Test requires two accounts: one to create invoice, another to access it expecting 404

Data center health worries animate midterm campaigns

Opposition to the rapid emergence of data centers in states such as Ohio and Arizona has ginned up activism and unified voters. A range of public health issues have played into the resistance.

  • Doug Herrera fears data center may harm health due to uranium mining.
  • City Council approved land sale for data center, awaiting zoning.
  • Midterm elections highlight contentious issue in Arizona's 1st Congressional District.

More from Thursday 29 October →