LoginSignup
0
0

More than 5 years have passed since last update.

phpメモ

Last updated at Posted at 2015-03-11

-r,--runオプション

コマンドラインでphpが実行できます.
例:試しに実行してみたい時などに...
php -r 'exec("whoami", $output, $return_var); print_r($output);'

-i,--infoオプション

phpinfoの実行結果をコマンドライン形式で返してくれます.

例:Apache経由で確認するのが面倒な時や、
新しくモジュールを追加した際など、Apacheを再起動する前の確認にも使えます.1
php -i | grep "newrelic"
※CGIモードだとhtml形式で出力量が多いようです. 試してないのであれですが( ◞‸◟ )
これも多くなるんだろうか...php -r "phpinfo();" | grep newrelic

複数台一気に確認したい時

cat serverList | xargs -I0 ssh 0 "php -i | grep apc.shm_size"

xargs

引数を標準入力から受け取る
-I ・・・ 標準入力より渡されたデータを、任意の位置の引数に展開


  1. 始めはrオプションでphpinfoを実行していましたが、phpinfo用のオプションがあるとのことをツイッターにて教えていただき変更しました!m(_ _)m 

0
0
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
0
0