PHP developer in Lyon

WordPress for businesses in Lyon, delivered remotely by one developer.

PHP developer

My place in the WordPress community

  • I have had a wordpress.org account since 2006.
  • I contributed to WordPress core for versions 7.0 and 7.1.
  • I maintain 30 plugins on wordpress.org.
  • I organise and speak at WordCamps.
  • I have attended every WordCamp Europe from 2017 to 2026.

My WordPress.org profile

Most PHP applications log in two ways. The web server and PHP write errors, and the application, if someone planned it, writes an audit trail of what users did. The CNIL recommendation on logging is about the second kind. My name is Mariusz Szatkowski and I develop from Gdynia, remotely and in writing. For Lyon projects I use the recommendation as a design brief for the audit trail and as a reason to review what the error log contains. I am not a lawyer, so the controller and its adviser decide what applies.

Hôtel de Ville in Lyon, seen from the Terreaux gallery

Hôtel de Ville, Lyon, from the Terreaux gallery. Image: Romainbehar, public domain (CC0), via Wikimedia Commons.

#What is the CNIL recommendation on logging?

Deliberation no. 2021-122 of 14 October 2021 adopts a recommendation on the retention and use of logging data. The Légifrance text, published in the Journal officiel of 30 October 2021, says it is neither prescriptive nor exhaustive. It rests on the GDPR, on the law of 6 January 1978 and on the security duties in articles 5 and 32 GDPR, and it notes that logs can also help document who received data, which links to the right of access in article 15.

The text sets the tension it tries to settle. Logs protect the system and let an organisation watch what authorised users do. Kept too long or filled with too much data, they become a risk of their own.

#Which logs does it cover?

The recommendation covers logging devices that trace the access and actions of authorised users in the application that carries the processing. It does not cover perimeter logs, which follow a different logic. It applies to public and private bodies, but not to processing whose main purpose is logging itself.

For a PHP application this draws a useful line. Web server access logs, firewall logs and PHP’s own error output sit on one side. The record of who read, changed or deleted a customer, an order or a medical note sits on the other, and that second record is what the recommendation addresses.

#Which events and fields belong in an audit entry?

For the general case the recommendation names the creation, consultation, modification and deletion of the data and information of the processing. An entry carries four things: the author, identified individually, a timestamp, the nature of the operation and a reference to the data concerned. It asks to avoid duplicating the data of the processing in the log, and to keep personal data in logs to a minimum.

That last point decides the shape of the code. A line that says user 4821 viewed customer record 77 at a given time answers the question. A line that copies the customer’s name, address and order total into the log creates a second copy of the data, with its own retention and its own access rules.

<?php
function audit(int $userId, string $operation, string $entity, int $entityId): void
{
    $line = json_encode([
        'at'     => (new DateTimeImmutable('now', new DateTimeZone('UTC')))->format(DATE_ATOM),
        'user'   => $userId,
        'op'     => $operation,   // create, read, update, delete
        'entity' => $entity,
        'id'     => $entityId,
    ], JSON_THROW_ON_ERROR) . "\n";

    error_log($line, 3, '/var/log/app/audit.log');
}

The sample logs identifiers only. The reference lets a person with the right access look up the record, and the log itself stays small.

#How does error_log fit?

The error_log() function in the PHP manual takes a message and a message type. Type 0, the default, sends the message to the system logger, and where it ends up depends on the error_log ini directive. Type 3 appends the message to the file named in the destination. The manual says no newline is added for type 3, so the caller adds it, as in the sample above. It also says the function is not binary safe: the message is cut at a null character, so encode messages that might contain one. The manual recommends absolute file paths.

Two settings matter for the other log, the one PHP writes for errors. The manual lists display_errors with a default of On, and says it should never be used on production systems. log_errors defaults to Off. The manual’s example for production sets display_errors = Off, log_errors = On, an error_log path and html_errors = Off, and states that error logging should be used in place of error displaying on production sites.

The privacy link is direct. A displayed error can show a query, a path or a parameter to the visitor. A logged error can hold the same text in a file that lives for years, with no retention rule. The CNIL recommendation does not cover PHP error output, but its logic applies by analogy: keep the personal data in error messages to a minimum and give the file a defined life.

#How long should logs be kept?

For the general case the recommendation gives six months to one year. The text allows more in defined situations:

  • For internal control of some processing with a demonstrated risk of misuse, with documented procedures, a period longer than one year can be retained. In the most common internal-control cases, the text says a maximum of three years can be justified.
  • A legal obligation, a specific purpose or post-incident analysis can justify a longer period if documented, and a data protection impact assessment can support it.
  • The limitation period for minor offences linked to misuse of the data does not justify retention on its own.
  • Where the main processing keeps its data for less than six months, the recommendation advises keeping only pseudonymous identifiers in the logs, or purging the matching data automatically.

The period is a decision. I do not pick it. I build the rotation once the controller has written it down, for example a daily file name and a job that deletes files older than the set period. Rotation also has to cover copies: a log deleted from the server and kept for years in a backup has not been deleted.

#How are logs protected and checked?

The recommendation goes beyond the log line. It asks for:

  • timestamping and signing of logs from the moment they are created
  • storage separate from the main system, write-only for applications, with no possibility of overwriting
  • access rights based on strict necessity
  • a system that processes and analyses the logs and raises alerts on abnormal behaviour, with a formal process to handle the alerts
  • an alert if an authorised account modifies the logs
  • information for the authorised users about the logging, the data collected and the retention period

Some of this is infrastructure, such as write-only storage. Some is code. A signature per entry can be built from hash_hmac() in PHP, which takes an algorithm such as sha256, the data and a secret key, and returns a hex string. Chaining each entry to the signature of the previous one makes deleted or altered lines visible. That construction is my illustration of what signing could look like, not a method the CNIL prescribes, and the key must live where the application’s own account cannot rewrite it.

<?php
function signed_line(string $json, string $previousSignature, string $key): string
{
    $signature = hash_hmac('sha256', $previousSignature . $json, $key);
    return $json . ' ' . $signature . "\n";
}

An alert on abnormal behaviour can start small: a scheduled script that counts consultations per user per hour and writes to the person responsible when one account reads far more records than its role suggests. The threshold belongs to the controller’s risk analysis.

#What changes with a subcontractor?

Where a subcontractor carries out the processing in whole or in part, the recommendation asks that the subcontract include a logging duty consistent with it. For a Lyon company that hires a PHP developer or an agency, that is a clause to check in the contract. It also means the developer should be able to say what the application logs and for how long. The recommendation adds that people exercise their rights regarding logs against the controller of the main processing, and that the entry in the register of processing activities can sit inside the entry of the processing concerned.

#What should a Lyon team write down?

  • Which actions are audit events, and which user roles can trigger them.
  • The fields of an audit entry, with a statement that the entry holds references, not copies.
  • The retention period per log, and who approved it.
  • Who can read the logs, and how access is reviewed.
  • Where the logs are stored, and how a change to them is detected.
  • What the error log may contain, and where PHP writes it.
  • The logging clause in the contract with any subcontractor.

#How does a project run?

  1. You send the application scope, the roles that handle personal data, where logs go today and your deadline. The reply comes by email.
  2. I read the existing logging against the events and fields above, and list the changes: new audit calls, removed fields, rotation, access.
  3. The build runs on a staging copy, where you check the audit entries and the rotation job with test users.
  4. With your written approval of the staging copy I deploy. For a WordPress part of the system, a maintenance plan covers updates.

The general offer is described on the PHP developer page.

#Tell me where your logs live

Lyon teams with a PHP application that handles personal data can use the contact form to say what the application records today, where the files go and who can open them. The first written estimate is free and lists the audit calls and rotation jobs I would add. Which retention period applies is for you and your adviser to settle.

Need this service: PHP developer in Lyon?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Latest PHP developer articles

Dec 2, 2026

Laravel Rust: what does it mean for PHP apps?

On 1 December 2026 Taylor Otwell shipped the Laravel Rust beta, and Laravel Go followed a day later. What the framework contains, what the 18x benchmark really measures, what happens to Laravel PHP and WordPress, and when a rewrite makes sense.

Explore other WordPress services and knowledge base