Wp-cli: PHP Notice: Constant ABSPATH already defined

Created on 6 Aug 2014  路  3Comments  路  Source: wp-cli/wp-cli

When I run wp db export, I get the following error:

PHP Notice:  Constant ABSPATH already defined in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(615) : eval()'d code on line 38

Is there an easy way to turn of PHP notices, or can you use defined()?

unconfirmed

Most helpful comment

This can also happen if you have a _really_ old WordPress installation that you've been updating all these years, as WP didn't always ship with the if (!defined... guard.

All 3 comments

Is it just wp db export, or is it other commands too?

Can you share the contents of your wp-config.php, minus secrets? The error specifically is because WP-CLI eval()s your wp-config.php to get the constants. Normally WordPress ships with this block, which you might've modified:

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

I wasn't using defined() in my wp-config.php, thanks!

This can also happen if you have a _really_ old WordPress installation that you've been updating all these years, as WP didn't always ship with the if (!defined... guard.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndrewCloss picture AndrewCloss  路  3Comments

JOduMonT picture JOduMonT  路  3Comments

dsgnr picture dsgnr  路  4Comments

ernilambar picture ernilambar  路  3Comments

blindpet picture blindpet  路  3Comments