2

I trying to use the wp-cli for wordpress in XAMPP:

I downloaded wp-cli.phar into wordpress directory in XAMPP in ubuntu 16.04

/opt/lampp/htdocs/wordpress/

prompting php wp-cli.phar

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

and checking the info: php wp-cli.phar --info

PHP binary: /usr/bin/php7.0
PHP version:    7.0.8-0ubuntu0.16.04.2
php.ini used:   /etc/php/7.0/cli/php.ini
WP-CLI root dir:    phar://wp-cli.phar
WP-CLI packages dir:    
WP-CLI global config:   
WP-CLI project config:  /opt/lampp/htdocs/wordpress/wp-cli.local.yml
WP-CLI version: 0.25.0

I notice that I'm not using the PHP installed inside XAMPP.

How can I change those wp-cli.phar path to use the php.ini in /opt/lampp/etc ?

fabio
  • 594
  • 8
  • 18
  • Which command line tool are you using? Git bash? ubuntu on windows etc ? – S. A. Malik Sep 18 '17 at 11:38
  • I am using bash – fabio Sep 20 '17 at 09:02
  • I am still not sure which command line tool you are using, but the problem is that when wp-cli runs in a directory the php version which it is able to run from the command is different from what you have used to run wordpress. It clearly shows that you have two php versions running on your system. Although the issue is old, but if you can tell me about bash, i will be able to help. – S. A. Malik Sep 21 '17 at 13:19

1 Answers1

1

Your output still looks like wpcli is using the php in your system rather than the php form xampp.

To make wpcli work with xampp you need to to define the following rules in the .profile file located in your home directory:

Step 1:

nano ~/.profile (or open your .profile with whatever editor you are              confortable with)

step 2: Add the following code at the very top of your .profile

# Define path for XAMPP
XAMPP_PATH=/opt/lampp/bin:/opt/lampp/sbin
export PATH="$XAMPP_PATH:$PATH"

Step 3: save (CTRL + O in nano and CTRL + X to exit/close)

Step 4: Run the source command to read, and execute the new PATH variable set in the .profile file.

$ source ~/.profile

Step 5: type wp --info and check the output. it should work perfectly with xampp this is actually my setup for Wordpress development.

Developer Guy
  • 2,318
  • 6
  • 19
  • 37