8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

エックスサーバーに wp-cli を導入する

Posted at

~/bin/ に導入し、エイリアスを張りました。

導入

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

動作確認

$ wp-cli.phar --info
X-Powered-By: PHP/5.3.3
Content-type: text/html

PHP binary:
PHP version:	5.3.3
php.ini used:	/etc/php53/php.ini
WP-CLI root dir:	phar://wp-cli.phar
WP-CLI global config:
WP-CLI project config:
WP-CLI version:	0.20.2

php-cli 経由で呼び出すようにする

help サブコマンドが下記のエラーになります。

$ wp-cli.phar help
PHP Warning:  proc_open() [<a href='function.proc-open'>function.proc-open</a>]: Descriptor item must be either an array or a File-Handle in phar:///home/username/bin/wp-cli.phar/php/commands/help.php on line 109
PHP Warning:  proc_close() expects parameter 1 to be resource, boolean given in phar:///home/username/bin/wp-cli.phar/php/commands/help.php on line 109
X-Powered-By: PHP/5.3.3
Content-type: text/html

下記のように php-cli 経由で実行してやるとうまくいきます。

$ php-cli wp-cli.phar help

なので、 .bashrcwp にエイリアスを張ってみました。

$ echo "alias wp='php-cli ~/bin/wp-cli.phar'" >> ~/.bashrc
$ source ~/.bashrc

参考文献

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?