Skip to content

Instantly share code, notes, and snippets.

@ko31
Last active May 4, 2020 07:16
Show Gist options
  • Save ko31/6c881a3fcd8532f816d56034cc2d8efb to your computer and use it in GitHub Desktop.
Save ko31/6c881a3fcd8532f816d56034cc2d8efb to your computer and use it in GitHub Desktop.
XSERVER に wp-cli をインストール

手順

インストールするディレクトリ作成

mkdir -p ~/local/bin

インストール

cd ~/local/bin
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar

動作確認

php wp-cli.phar --info

wp エイリアス作成

vi ~/.bashrc
alias wp='php ~/local/bin/wp-cli.phar'
source ~/.bashrc

エラーが出る場合

下記のように PHP バージョンによるエラーが出る場合。

Your server is running PHP version 5.4.16 but WordPress 5.2.4 requires at least 5.6.20.

高いバージョンの PHP コマンドパスを指定して実行されるようにする。

vi ~/.bashrc
alias wp='/opt/php-7.3.8/bin/php ~/local/bin/wp-cli.phar'
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment