WP-CLI » WP-CLI Not Working: Call to undefined function exec()

WP-CLI Not Working: Call to undefined function exec()

For some operations such as database export, WP-CLI uses PHP exec() function which is disabled on most shared hosting servers.

So if you do wp db export and no file was created, make sure to check your error_log file and if you notice this error:

PHP Fatal Error: Uncaught Error: Call to undefined function exec()

chrome vHQjzpKFoH 1024x258 - WP-CLI Not Working: Call to undefined function exec()
PHP Fatal Error: Uncaught Error: Call to undefined function exec()

To fix this you need to enable the exec extension if possible. For cPanel enable the exec extension in PHP Selector

image 59 - WP-CLI Not Working: Call to undefined function exec()
cPanel > PHP Selector

or if you have WHM access (VPS or Dedicated server) then you can also edit the php.ini file directly.

image 60 1024x665 - WP-CLI Not Working: Call to undefined function exec()
WHM > MultiPHP INI Editor
See also  Can’t Add or Install Plugins in WordPress

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended