Skip to content

Instantly share code, notes, and snippets.

@humayunahmed8
Last active February 17, 2022 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save humayunahmed8/8f4a6baa95dac6c8ff2b50a1e14d0ad4 to your computer and use it in GitHub Desktop.
Save humayunahmed8/8f4a6baa95dac6c8ff2b50a1e14d0ad4 to your computer and use it in GitHub Desktop.
How to configure wp-cli
# Prerequisite
================
1. Download **xampp or wamp**
2. Download Powershell (https://github.com/PowerShell/PowerShell/releases/download/v7.2.1/PowerShell-7.2.1-win-x64.msi)
3. Create "wp.bat" file
4. Download "wp-cli.phar" (https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar)
# Official Doc:
================
1. WP CLI phar - https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
2. WP CLI Commands - https://developer.wordpress.org/cli/commands/
# How to configure:
====================
1. Create a folder in => c:\wp-cli
2. Download "wp-cli.phar" file and put it c:\wp-cli
3. Create a filename like "wp.bat" in "c:\wp-cli"
4. Add this code in "wp.bat" file :
@ECHO OFF
php "c:/wp-cli/wp-cli.phar" %*
5. Go to "This PC > Properties > System Protection > Advance > Environment Variables > Path > Edit > New
6. After click New add this code below =>
c:\wp-cli
F:\xampp\php
F:\xampp\mysql\bin
1. Go to localhost/phpmyadmin
2. Select the current database
3. Go to wp_options table
4. Change the siteurl and home url : http://localhost:8080 (See screenshot)
Doc Link : https://developer.wordpress.org/cli/commands
==========================================================
1. wp core download (download wordpress)
2. mysql -u root (switch to database)
3. create database db_name; (create a database)
4. wp config create --dbname=db_name --dbuser=root (Configure Databse with wordpress)
5. wp core install --url="F:\xampp\htdocs\project-name" --title="Project Title" --admin-user="admin" --admin_email="test@exmaple.com" --admin_password="admin" (Intall wordpress)
6. wp server (Listen to server)
7. Run wordpress => http://localhost:8080
8. ctrl+c (close command)
9. clear (clear command line)
@humayunahmed8
Copy link
Author

Screenshot_174

How to add "Environment Variables"

@humayunahmed8
Copy link
Author

Screenshot_175

Add new "Environment Variables" =>

c:\wp-cli
F:\xampp\php
F:\xampp\mysql\bin

@humayunahmed8
Copy link
Author

Screenshot_176

How to use PowerShell in vs code

@humayunahmed8
Copy link
Author

humayunahmed8 commented Feb 17, 2022

Screenshot_177

Change siteurl or home url from phpmyadmin

http://localhost:8080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment