FastCGI sent in stderr: "PHP message: PHP Warning: Constant WP_CRON_LOCK_TIMEOUT already defined

Getting the following error in my error log after upgrading to 8.1.

2024/04/02 20:36:22 [error] 27135#27135: *83883 FastCGI sent in stderr: “PHP message: PHP Warning: Constant WP_CRON_LOCK_TIMEOUT already defined in /xxxx/public/wp-config.php on line 91PHP message: PHP Warning: Constant AUTOSAVE_INTERVAL already defined in xxxxx/public/wp-config.php on line 92PHP message: PHP Warning: Constant WP_POST_REVISIONS already defined in /xxxxxx/public/wp-config.php on line 93PHP message: PHP Warning: Constant EMPTY_TRASH_DAYS already defined in /xxxxxx/public/wp-config.php on line 94”, client: xxxxxx, server: xxxxxxx, request: “GET / HTTP/2.0”, host: “xxxxx”

Looked for FastCGI plugin and none present. There must be another plugin using it that causing this?

Any ideas where to look?

Hello @calmond :wave:

I would like to welcome you to the Kinsta Community!

If you need to find files where the WordPress constants can be found, you can use the grep command via SSH. For instance, if you need to locate “WP_CRON_LOCK_TIMEOUT”, you can run the command grep -rl "WP_CRON_LOCK_TIMEOUT" ~/public. By running the grep command, you can search for entries containing “WP_CRON_LOCK_TIMEOUT” recursively from the ~/public folder.

To log in via SSH, please refer to our help article at WordPress Hosting - SSH - Kinsta® Docs for detailed instructions.

I hope it helps!

HI Adrian.

Thank you very much for sharing the grep command.

That did indeed show where the additional declarations reside:

/www/xxxxxxxx/public/wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php- ‘ALTERNATE_WP_CRON’,

/www/xxxxxxxx/public/wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php: ‘WP_CRON_LOCK_TIMEOUT’,

/www/xxxxxxxx/public/wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/class-defaults.php- ‘PHP_VERSION’,

Although this is puzzling as I have deleted the jetpack plugin yet it is still present in the file system.

I guess its safe to just ignore this error in the logs?

(I’m afraid to delete the Jetpack directory)

Thank you,

-Chris.

FULL GREP RESPONSE -----------------

/www/xxxxxxxx/public/wp-cron.php- // Called from external script/job. Try setting a lock.

/www/xxxxxxxx/public/wp-cron.php: if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) {

/www/xxxxxxxx/public/wp-cron.php- return;

Hi @calmond ! :wave:

The error in question (Constant already defined) indicates that the entries in your wp-config.php file have duplicate entries that are being loaded elsewhere. This can be an issue if your application (WordPress) is expecting one value for one of those entries, and it’s being overwritten by the variable being specified somewhere other than where you set the value originally.

You can remove or comment out those entries from wp-config.php to stop the errors if you don’t need those variables defined there.

Otherwise, you would want to remove or edit the secondary locations where those variables are being specified, to eliminate the duplication.

However by itself this error this error is not fatal to the site operation, so you can ignore it if you would like.

Still getting errors in log…even though jetpack directory is now gone…

Lates grep results…

mailhippo@rhc-mailhippo-live-prod:~$ grep -rl “WP_CRON_LOCK_TIMEOUT” ~/public
/www/mailhippo_201/public/wp-cron.php
/www/mailhippo_201/public/wp-includes/default-constants.php
/www/mailhippo_201/public/wp-includes/cron.php
/www/mailhippo_201/public/wp-config.php
/www/mailhippo_201/public/wp-content/plugins/updraftplus/updraftplus.php

Disabled and Removed updraftPlus plugin using console.
Restarted PHP engine.
Still getting errors.

2024/04/17 01:14:02 [error] 121249#121249: *289836 FastCGI sent in stderr: "PHP message: PHP Warning: Constant WP_CRON_LOCK_TIMEOUT already defined in /www/mailhippo_201/public/wp-config.php on line 97PHP message: PHP Warning: Constant AUTOSAVE_INTERVAL already defined in /www/mailhippo_201/public/wp-config.php on line 98PHP message: PHP Warning: Constant WP_POST_REVISIONS already defined in /www/mailhippo_201/public/wp-config.php on line 99PHP message: PHP Warning: Constant EMPTY_TRASH_DAYS already defined in /www/mailhippo_201/public/wp-config.php on line 100" while reading response header from upstream, client: 174.163.22.49, server: www.mailhippo.com, request: "POST /wp-admin/admin-ajax.php HTTP/2.0", upstream: "fastcgi://unix:/var/run/php8.1-fpm-mailhippo.sock:", host: "www.mailhippo.com:48033", referrer: "https://www.mailhippo.com/wp-admin/plugins.php?plugin_status=all&paged=1&s"

@calmond :wave:

It appears that the problem you’re experiencing may be related to cached data. I recommend clearing the cache in MyKinsta > Your site > Server cache (clear cache). This is because your staging site has the same custom configuration in its wp-config.php file but is not displaying any PHP warnings.

Let us know how it goes.

Thanks for the reco.

Cleared cache by:
MyKinsta > MailHippo > Tools > Server cache > Clear cache.

Still getting same errors.

Hi @calmond

I was able to take a look at the site itself; currently the wp-config.php file has a set of constants, including WP_CRON_LOCK_TIMEOUT, loading after this section:

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
        define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

Can you please move these lines before this line in wp-config.php?

/* That's all, stop editing! Happy blogging. */

Then clear caches for the site. I believe that should resolve these errors you’re receiving.

Jack.
Thanks for the troubleshooting and the tip.

Your suggestion worked flawlessly. No more errors.

Thank you!!

I wonder how those lines got put there in the wp-config.php.
I don’t monkey with that file.

At least its fixed now.

Thanks again.
-Chris.

1 Like

Hi @calmond ,

Awesome, I’m glad to hear it! Please let us know if you have any other questions as well.

Best,
Jack

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.