How to eliminate php5 Strict standards errors?

How to eliminate php5 Strict standards errors?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

How to eliminate PHP 5 Strict Standards errors

Upgrading from an older PHP version to 5.4.3 introduced a new layer of scrutiny into your runtime environment. The specific error messages you are encountering—"Redefining already defined constructor" and "Non-static method should not be called statically"—are direct consequences of the E_STRICT flag being active in your error reporting configuration.

While simply adding ~E_STRICT to your error_reporting setting is a common suggestion found online, it often fails if applied incorrectly or if the application's internal logic conflicts with the new version's standards. You mentioned modifying both C:\wamp\bin\php\php5.4.3\php.ini and C:\wamp\bin\apache\apache2.4.2\bin\php.ini. It is critical to understand that WAMP servers typically run PHP via the Apache module, meaning the configuration in C:\wamp\bin\apache\apache2.4.2\bin\php.ini (or php5.ini) is usually the one that matters for your web requests. Changing the file in the bin\php directory might only affect CLI scripts or processes spawned by other services, leaving the Apache module untouched.

Furthermore, attempting to bypass this via .htaccess using php_value error_reporting 6143 is ineffective because the CakePHP framework itself is outputting these warnings before the .htaccess rules in your root directory are fully processed or if the directive is overridden by a higher-level configuration. The constant E_ALL includes all errors, warnings, and notices. To strictly ignore strict standards warnings while keeping other errors visible, you need to ensure the value passed to error_reporting explicitly excludes E_STRICT.

The underlying issue in your logs stems from two specific incompatibilities between CakePHP 1.3 and PHP 5.4:

  1. Constructor Redefinition: The error indicates that a class named Object is attempting to redefine its constructor (__construct). In strict mode, PHP forbids redefining methods unless the new definition is at least as permissive as the old one, or if it's being called in a specific context. This often happens when legacy code tries to extend internal classes in ways that modern interpreters no longer allow.
  2. Static Call to Non-Static Method: The call to Configure::getInstance() suggests that the framework is treating a method as static when it might actually require instantiation, or the API has shifted slightly between versions.

Since you cannot upgrade CakePHP due to dependencies on Firebird (a database driver often tightly coupled with older CakePHP versions), you must address this at the configuration level without silencing all errors. The goal is to stop the output of strict standards warnings specifically.

To resolve this, locate your active PHP configuration file used by Apache (C:\wamp\bin\apache\apache2.4.2\bin\php.ini). Add or modify the following line at the very top of the file, before any other error_* directives:

error_reporting = E_ALL & ~E_STRICT
display_errors = On
log_errors = Off

The value E_ALL & ~E_STRICT ensures that PHP reports all errors except those related to strict standards. This allows you to fix the code eventually while keeping your application functional on PHP 5.4.3. If you are using a custom error handler or if the warnings are appearing in a log file rather than the browser, ensure log_errors is set appropriately so you can still debug non-strict issues.

If modifying the global php.ini does not persist after restarting Apache, check if WAMP has created a user-specific configuration in C:\wamp\bin\php\php5.4.3\php.ini. However, for web contexts, the Apache-specific ini file is authoritative. Remember to restart the Apache service within the WAMP control panel for changes to take effect.

This approach allows you to maintain compatibility with your existing Firebird setup and legacy CakePHP code while adhering to modern PHP error reporting standards. If the warnings persist despite correct configuration, the application may be loading a cached opcode from the older PHP 5.3 environment; ensuring a clean restart of both Apache and the WAMP server is essential to force PHP to re-read the new configuration directives.

Our network