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()?
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.
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.