XHProf - andyceo/documentation GitHub Wiki
-
Устанавливаем через репозиторий: https://launchpad.net/~brianmercer/+archive/php5-xhprof
-
Правим конфиг для
php:/etc/php5/conf.d/xhprof.ini. По умолчанию после установки там будет такое содержимое, и его на первых порах достаточно:extension=xhprof.so xhprof.output_dir=/tmp -
Создаем конфиг виртуального хоста для
nginx, чтобы можно было смотреть отчеты XHProf через браузер:# Virtual host xhprof.local server { listen 80; server_name xhprof.local; root /usr/share/php5-xhprof/xhprof_html; location ~ \.php$ { proxy_pass http://backend; include /etc/nginx/proxy.conf; } location ~ /\.ht { deny all; } } -
Затем создаем конфиг для Apache:
# Virtual host xhprof.local Alias /xhprof /usr/share/php5-xhprof/xhprof_html <Directory /usr/share/php5-xhprof/xhprof_html> Options FollowSymLinks DirectoryIndex index.php </Directory> # Disallow web access to directories that don't need it <Directory /usr/share/php5-xhprof/xhprof_lib> Order Deny,Allow Deny from All </Directory> # xhprof separate virtual host configuration <VirtualHost 127.0.0.1:8080> ServerName xhprof.local DocumentRoot /usr/share/php5-xhprof/xhprof_html ErrorLog /var/log/apache2/xhprof.local.error.log # Possible values include: debug, info, notice, warn, error, crit, alert, emerg. LogLevel warn CustomLog /var/log/apache2/xhprof.local.access.log combined </VirtualHost> -
Для включения логирования в
Drupal, нужно установить модульDevel, затем в его настройках в разделе XHProfadmin/config/development/develустановить следующие значения:-
Enable profiling of all page views and drush requests: поставить галочку - XHProf directory:
/usr/share/php5-xhprof/ - XHProf URL:
http://xhprof.local/
-