According to Alain Schlesser in wordpress slack:
The folder that the packages are installed into is set to use your server user’s home folder. When you try to execute this command from PHP, however, it is being executed by the webserver’s user, which probably has a different home folder, and the package is not installed in there.
You can either load the package manually as part of the system (requiring it in the site’s Composer stack, for example), or set the package folder to a location that is shared by both your user and your webserver (and reinstall it afterwards).
You can set the packages folder with the WP_CLI_PACKAGES_DIR environment variable: https://make.wordpress.org/cli/handbook/config/#environment-variables
Related Posts:
- Running WP Cron on multisite the right way
- WP-CLI – Selecting PHP version
- WP CLI info showing correct PHP binary but wrong version of PHP
- Utilize WP-CLI from inside WordPress, not SSH
- Setting Up PHPUnit tests for WP development on Windows
- Configuring WP-CLI on Windows 10
- PHPCS: Strings should have translatable content
- wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported
- PHP Parse error on WP-CLI, not on web server
- WP-CLi PHP Warning: mysqli_query(): (HY000/1356): View During Search Replace
- call to undefined function mysql_connect
- How come there is no error if I upgrade WordPress core after locking .htaccess permissions to 644?
- Full search and replace isn’t enough to make all pictures to be loaded with https
- Cannot register a custom WP-CLI command
- Run a WP-CLI command from within PHP without using shell_exec()
- Running WP-Cron on Multisite networks the right way?
- Only get_posts of certain post formats
- Does an activated plugin automatically mean its methods are available to other WP functions?
- Proper use of Output Buffer
- Correct regex for wp_embed_register_handler
- Is having multiple theme customizers for different pages possible?
- Get the php template file from other theme folder
- Site Title and Tagline in Pagelines DMS Options Panel
- Creating a WordPress form with a PHP script and default header
- Can we have a php “page” without a WordPress “page”?
- API JSON Data in WordPress
- How To add custom radio boxes to WooCommerce Billing page and change total price by this field?
- WooCommerce: update custom fields after checkout validation failure
- PHP Code stuck in Cache [Memcached] [closed]
- jQuery .each to get post meta and subtract from a sum
- Store and Work with huge array in WP [closed]
- jQuery not defined
- dynamic page in WordPress
- Apache Fallback instead of add_rewrite_rule
- Correct folder permissions?
- Link posts to pages for breadcrumbs
- Pagination of custom mysql in wordpress
- WordPress wpform plugin submit and get multiple checked value from checkbox [closed]
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Script to browser problem PHP
- wp_nav_menu returns menu list in ascending order. How can I arrange the menu same as dashboard menu
- How can I add extra word in permalink when someone click download button?
- Trying to get a PHP variable defined in a custom post into a javascript file. Null value. Using wp_localize_script
- How to retrieve the sender email with wp_mail()?
- Why WordPress won’t update via VPN?
- WordPress update_post_meta updating with empty meta_value field [closed]
- Create custom permalinks to show Custom Post Type’s relationship?
- Can WP plugins access files outside the installation folder?
- Issues when changing == to ===
- Having Issue on Redirecting With Session in WordPress
- Why is $wp->request empty in WordPress 6.0?
- linking stylesheets and scripts with functions.php
- Add class to DIV depending on page loaded
- Make a database query using WordPress
- get_the_ID() in the footer returns wrong value
- Syntax issue on rest object’s callback
- Hooks for post saving make a post-new.php to load latest post’s data
- WP_Query multiple post results
- Convert Featured products loop into Recent products loop?
- Issue Enqueueing WordPress style.css
- Add valid XHTML closing img tags to WordPress galleries
- Show field if it has contents on Advanced Custom Fields
- Changing wordpress default language
- Class for Selected Menu using wp_nav_menu
- Contact form – problem with displaying message about sent mail
- How to Redirect Buddypress Directories To Login Page For Non Logged in Users
- Prevent Buddypress Rewrite Rules on Non-Buddypress pages/posts
- Adding image upload in tag section – WordPress plugin development
- How do I set a hidden field to a value?
- Display logged in user name and lastname on page
- How to Add a cutsom slug to my custom author role
- WordPress sorting posts by date and title using a dropdown
- How to output the taxonomies that are assigned to each custom post?
- Reading URL Parameters
- Conditional formatting on data fetched from MYSQL
- opens like sitename.com/URL
- Enqueue script only on child pages of custom post types
- Attach and retrive multiple pdf files to post or page
- Link to index.php from home.php?
- How do I remove an action hook inside a class that is called by another class?
- Merging Multiple WordPress Websites
- Replace an array (with identical values) with another array in the_content
- WordPress/NGINX not respecting the category URL for new posts
- Display current user metadata on WordPress page
- PHP Error Backtrace / create_function deprecated
- Filtering markers on google map by WordPress category[SOLVED]
- scroll scrpit to particular button position to next id when click button
- What is wrong in this code?
- perform mathematical operation on shortcode
- Create page in templates for pages or the pages manager?
- wp_nav_menu prints children with parent name
- directorypress theme error mysql_error() [closed]
- wp add inline style in loop
- Do_shortcode on PHP file outside theme ALMOST works
- WordPress 2014 Theme – Featured Content with multiple tags?
- Does wp_query and query_posts affect website performance? [duplicate]
- Facebook share button only share the_permalink(), without thumbnail, tilte, excerpt, etc
- Woocommerce – Shipping tax class based on cart items not using the highest tax available
- ACF repeater image in video poster with jquery
- What is proper way to use the php if statement? [closed]