Skip to content

Instantly share code, notes, and snippets.

@junaidtk
Created November 25, 2021 08:57
Show Gist options
  • Save junaidtk/6e65484141a8796ac42b5878ba88edbc to your computer and use it in GitHub Desktop.
Save junaidtk/6e65484141a8796ac42b5878ba88edbc to your computer and use it in GitHub Desktop.
WP-CLI
WP-CLI
=======
WP-CLI is a command line interface for wordpress. You can install WP, update plugin, install plugin, configure multisite and Much more without using web browser.
Download the wp-cli.phar file using wget or curl.
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Then, check if it works:
php wp-cli.phar --info
To be able to type just wp, instead of php wp-cli.phar, you need to make the file executable and move it to somewhere in your PATH. For example:
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
Download and install WordPress in seconds
Download the latest version of WordPress with
wp core download --path=wpclidemo.dev
Create a new wp-config.php file with wp config create
wp config create --dbname=thpolylng --dbuser=root --dbpass=root --dbhost=localhost
It may arise an error like below:
env: mysql: No such file or directory.
If you are using the MAMP, Then you can use MAMP php for the PHP binary.
So you can add MAMP PHP defnitions in the .bash_profile file. It will available in ~/ folder.
if it doesn't exist, you can create it by
cd ~/
touch .bash_profile
then edit the file and add below items.
PHP_VERSION=$(ls /Applications/MAMP/bin/php/ | sort -n | tail -1)
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
export PATH=$PATH:/Applications/MAMP/Library/bin
then run by below command.
source ~/.bash_profile
and check
wp --info
then run
wp config create --dbname=thpolylng --dbuser=root --dbpass=root --dbhost=localhost
after creating config file run below command.
wp db create
then install the WordPress by using below command.
wp core install --url=localhost/wppolylang --title="WP-Plylang" --admin_user=admin --admin_password=admin123 [email protected]
It will successfully install the WordPress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment