WP-CLI commands allow you to perform common WordPress management tasks via the command line. An example would be the ability to completely install WordPress from the command line.

To set up a new WordPress website from the command line, we recommend that you follow the instructions below.

! Due to the way cPanel manages databases, if you create a WordPress database with WP-CLI, it will not be accessible. Therefore, it is necessary to create a MySQL database in cPanel. Then, create a MySQL database user and assign all privileges to him to be able to access it.

How to install WordPress with WP-CLI

- Log in to the server via SSH with cPanel user who owns the website on which you want to install WordPress

- Use the cd command to access the root folder of your website eg:

cd public_html/wp

Replace public_html/wp with the actual path to the root folder of your website.
 

Run the following command to download WordPress (in the root folder you are in):

wp core download

Run the following command to configure WordPress:

wp core config –prompt

See the table below for a description of the values you will enter when prompted:

Prompt Description Value
1/11 dbname: * Enter the name of the MySQL database created exemplu_wp
2/11 dbuser: * Enter the name of the MySQL database user created exempl3_wp
3/11 dbpass: * Enter the password created for the database user F#3#eswdw
4/11 dbhost: Enter the hostname of the MySQL database server  
5/11 dbprefix: Enter the prefix to use in the MySQL database structure  
6/11 dbcharset: Enter the database character set  
7/11 dbcollate: Enter the database collation  
8/11 locale: Enter the WPLANG constant  
9/11 extra-php (Y/n): * Enter Y to add any PHP code from STDIN or n to skip n
10/11 skip-salts (Y/n): * Enter Y to generate or n to skip generating keys and salts n
11/11 skip-check (Y/n): * Enter Y test or n to skip testing the database connection n

Enter the custom value and then press the Enter key to scroll through each request.

! the values in the table are values used for the example given here. Some values are intentionally missing. In this case, the default configuration will be used. Make sure you use your own custom values. To use a default value, simply press the "Enter" key (without entering data) to continue the steps. Requests in the table marked with an asterisk (*) require a custom value (you cannot leave these fields blank).

Run the following command to install WordPress:

wp core install –prompt

See the table below for a description of the values you will enter when prompted:

Prompt Description Value
1/6 url: Enter the URL for your website example.com
2/6 title: Enter the site title for your website WPCLI Example Site
3/6 admin_user: Enter the administrator username exemplu_wpadmin
4/6 admin_password: Enter the administrator password Fdk9##dm2w
5/6 admin_email: Enter the email address for the administrator [email protected]
6/6 skip-email (Y/n): Enter Y to email or n to skip emailing the admin details Y

Type the selected value and then press the Enter key to scroll through each request.

! the values in the table are values used for the example given here. Make sure you use your own custom values. All requests require custom values (you cannot leave fields blank).

 

For assistance in applying the above instructions on HostX servers please contact us. HostX offers the fastest WordPress hosting and can help you solve your problems.

Was this answer helpful? 0 Users Found This Useful (0 Votes)