wp-cli displays php notices when display errors off

I am using wp-cli and I am having php notices and errors show up when running wp-export. Some of these warnings and errors are ending up in the output file. How can I force errors to NOT show up. I have tried ini_set('display_errors', 0); and error_reporting(0); in wp-wp-config.php

root@roc-apache-4:/var/www/blogs/html# wp export --quiet=true --debug=false --url=http://blogs.democratandchronicle.com/fleet-feet-beat/ --dir=/root/wordpress_exports --file_item_count=100000000
PHP Notice:  date_default_timezone_set(): Timezone ID 'America/New York' is invalid in phar:///usr/bin/wp/php/wp-cli.php(21) : eval()'d code on line 16
PHP Notice:  Constant ABSPATH already defined in phar:///usr/bin/wp/php/wp-cli.php(21) : eval()'d code on line 68
PHP Notice:  Undefined index: combineCommentCounts in /var/www/blogs/html/wp-content/plugins/facebook-comments-for-wordpress/facebook-comments.php on line 265

Notice: Undefined index: combineCommentCounts in /var/www/blogs/html/wp-content/plugins/facebook-comments-for-wordpress/facebook-comments.php on line 265
PHP Notice:  define() was called with an argument that is <strong>deprecated</strong> since version 3.0! The constant <code>VHOST</code> <strong>is deprecated</strong>. Use the boolean constant <code>SUBDOMAIN_INSTALL</code> in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled. in /var/www/blogs/html/wp-includes/functions.php on line 3466

4 s
4

First, you have to do your PHP error settings in your php.ini file unless the PHP ini directives don’t list it as PHP_INI_ALL – which is the case for nearly error related definition.

So I’m assuming you just misread something and set stuff to wp_settings.php instead of wp-config.php.

The next point is that WP CLI might run WP in different cases without some stuff loaded, so it could get bypassed.

The safest point to set some php.ini stuff always is your php.ini file. And if you can’t work around errors: Go and fix them – that’s what errors, warnings and notices are for. If it’s a plugin causing it, send a pull request and notify the author.


Note: If you are in/on your Terminal/Command Line, you can use php --ini to list all locations where your php.ini files are stored. Some operating systems support different locations per default. And some packages like XDebug have additional locations per default.

Example php --ini result on Windows:

Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         C:\dev\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Example php --ini result on Ubuntu 12.04 LTS:

Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed:      /etc/php5/cli/conf.d/05-opcache.ini,
/etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-curl.ini,
/etc/php5/cli/conf.d/20-gd.ini,
/etc/php5/cli/conf.d/20-json.ini,
/etc/php5/cli/conf.d/20-mysql.ini,
/etc/php5/cli/conf.d/20-mysqli.ini,
/etc/php5/cli/conf.d/20-pdo_mysql.ini,
/etc/php5/cli/conf.d/20-readline.ini,

Leave a Comment