LoginSignup
25
23

More than 5 years have passed since last update.

xhprofを使ってみた(インストール編)

Last updated at Posted at 2014-08-09

会社で運営しているサイトのパフォーマンスチェックする仕事をする機会があり
処理の各ステップにログを仕込んでパフォーマンスが悪いところを洗い出すのはつらいなーと思っていたところ
google先生がxhprofを教えてくれました。
パフォーマンスが悪い箇所をグラフ表示してくれるCallgraphも素敵!ということで、早速使ってみることにした。

まずはインストールから

環境

CentOS 6.5
PHP 5.5.15

インストール

1.peclでxhprofをインストール

gccが入ってなかったので入れる

# yum -y install gcc

xhprofをインストール

# pecl install channel://pecl.php.net/xhprof-0.9.4
downloading xhprof-0.9.4.tgz ...
Starting to download xhprof-0.9.4.tgz (842,077 bytes)
・
・
・
Build process completed successfully
Installing '/usr/lib64/php/modules/xhprof.so'
install ok: channel://pecl.php.net/xhprof-0.9.4
configuration option "php_ini" is not set to php.ini location
You should add "extension=xhprof.so" to php.ini

2.php.iniを編集

# vi /etc/php.ini

[xhprof]
extension=xhprof.so
xhprof.output_dir="/var/log/xhprof/"

3.ログディレクトリを作成

# mkdir /var/log/xhprof/
# chmod 777 /var/log/xhpof/

4.Apache再起動

# service httpd restart

5.phpinfo()で確認

xhprof.jpg

インストール完了

25
23
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
25
23