https://www.howtoforge.com/tutorial/perfect-server-debian-8-jessie-apache-bind-dovecot-ispconfig-3/
Download and Configure WP-CLI
The next thing is to download wp-cli.
wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --no-check-certificate
Now make the file executable.
chmod +x wp-cli.phar
Move the file to the /usr/bin
folder and change the name to wp
.
mv wp-cli.phar /usr/bin/wp
Make WP-CLI Available for New Jailed Users
Go back into the jk_init.ini
file.
nano /etc/jailkit/jk_init.ini
Now add the configuration for wp-cli to the bottom of the file.
[wp] comment = WordPress Command Line executables = /usr/bin/wp includesections = php
Make PHP Available for New Jailed Users
The first step is to make PHP available in the jail from the command line. Open the jk_init.ini
file using a text editor of your choice.
nano /etc/jailkit/jk_init.ini
Add the following to the bottom of the jk_init.ini
file.
[php] comment = The PHP Interpreter and Libraries executables = /usr/bin/php5, /usr/bin/php directories = /usr/lib/php5, /usr/share/php, /usr/share/php5, /etc/php5, /usr/share/php-geshi, /usr/share/zoneinfo includesections = env [env] comment = Environment Variables executables = /usr/bin/env
Make MySQL Available for New Jailed Users
Now we need to make MySQL available for the jail. Open the jk_init.ini
file using a text editor.
nano /etc/jailkit/jk_init.ini
Add the following to the bottom of the jk_init.ini
file.
[mysql] comment = MySQL Client executables = /usr/bin/mysql
Enable PHP, MySQL & WP-CLI for Existing Jailed Users
To make WP-CLI available to existing jailed users, you will need to run the following command for each jail. (Use the appropriate path for each jail.)
Example One:
jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client1/web1 php mysql wp
Example Two:
jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client3/web13 php mysql wp
Note: Jailkit will try to link all the necessary dependencies/libraries when creating/modifying the jail. But, you may need to add any that are listed in error messages. Below is an example how to add the library /lib/x86_64-linux-gnu/libgcc_s.so.1
for MySQL in the /etc/jailkit/jk_init.ini
configuration file.
[mysql] comment = MySQL Client executables = /usr/bin/mysql libraries = /lib/x86_64-linux-gnu/libgcc_s.so.1
Enable PHP, MySQL & WP-CLI for New Jails in ISPConfig 3
Login to your ISPConfig 3 hosting control panel and select the System tab. Under the System Menu, select Server Config. Next, choose the appropriate server and navigate to the Jailkit tab. Then add the values php
mysql
wp
to the section Jailkit chroot app sections
. Make sure there is only a space, and not a comma between each value.
Allow MySQL a TCP or Socket Connection
There are additional steps to allow MySQL a TCP, or Socket connection for WP-CLI that are not yet complete. For now, a workaround has been established by adding if
and else
statements to the define('DB_HOST', '');
section in the WordPress wp-config.php file.
For existing WordPress websites, open the wp-config.php file. (Use the appropriate path.)
nano /var/www/clients/client1/web1/web/wp-config.php
Delete this section.
/** MySQL hostname */ define('DB_HOST', 'localhost:3306');
Now replace it with this section and save the file.
/** Tell WP-CLI to use TCP instead of socket connection */ if ( defined( 'WP_CLI' ) && WP_CLI ) { /** MySQL hostname for WP-CLI */ define('DB_HOST', '127.0.0.1:3306'); } else { /** MySQL hostname */ define('DB_HOST', 'localhost:3306'); }
Testing WP-CLI
Login to a new or existing SSH jail and navigate to the websites root directory.
cd /web
Check to make sure WP-CLI functions.
wp --info
You should receive an output similar to the following.
PHP binary: /usr/bin/php5 PHP version: 5.6.24-0+deb8u1 php.ini used: /etc/php5/cli/php.ini WP-CLI root dir: phar://wp-cli.phar WP-CLI packages dir: WP-CLI global config: WP-CLI project config: WP-CLI version: 0.24.0
WP-CLI Documentation & Resources
-
CanaKit Raspberry Pi 3 B+ (B Plus) with 2.5A Power Supply (UL Listed)
-
TYT TH-7800 50W Dual Band Dual Display Repeater Car Truck Ham Radio
$245.99 -
TYT TH-9000D 136-174MHz 60W 200CH 8 Group Scrambler Car Truck Mobile Ham Radio
-
The ARRL Ham Radio License Manual Spiral
Original price was: $32.95.$8.63Current price is: $8.63. -
The ARRL Extra Class License Manual Spiral 11th Edition
Original price was: $32.95.$18.30Current price is: $18.30. -
The ARRL General Class License Manual Spiral Bound
$49.00 -
RSRF LMR 400 Crimp Tool (RG-8, RG-9, and Belden 9913)
$37.95 -
rmsdeal77 Coax Wire Cable Stripping Tool for RG-8, 9, 213, 214, LMR400, 3-bladed
-
rmsdeal77 Coax wire cable stripping tool for RG-8, 9, 213, 214, LMR400, 2-bladed
$12.50 -
Install Your Own Solar Panels: Designing and Installing a Photovoltaic System to Power Your Home
Original price was: $19.99.$13.99Current price is: $13.99.