Closed snowlyg closed 5 years ago
@snowlyg nginx重启了吗?还有你看看phpinfo() 是否加载成功
nginx 重启过了, phpinfo() 没有加载到 xhprof。是php.ini 配置有问题吗?
[xhprof] extension = xhprof.so xhprof.output_dir = /tmp/xhprof
检查下php.ini对应的php,是不是当前的这个
@longxinH 可以了,原来还要重启 php7.2-fpm 。
@longxinH
使用 php -m 和 php -i 都显示xhprof 模块已经加载: xhprof
xhprof support => enabled Version => 2.0.5
Directive => Local Value => Master Value xhprof.output_dir => /tmp/xhprof => /tmp/xhprof xhprof.sampling_depth => 0x7fffffff => 0x7fffffff xhprof.sampling_interval => 100000 => 100000
编译也没有报错:
/bin/bash /var/www/xhprof/extension/libtool --mode=install cp ./xhprof.la /var/www/xhprof/extension/modules libtool: install: cp ./.libs/xhprof.so /var/www/xhprof/extension/modules/xhprof.so libtool: install: cp ./.libs/xhprof.lai /var/www/xhprof/extension/modules/xhprof.la libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath_target_11007265:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/d/php7.2.5:/mnt/c/composer:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/d/Program Files/Java/jdk1.8.0_181/bin:/mnt/d/Program Files/Java/jdk1.8.0_181/jre/bin:/mnt/c/Users/Administrator/AppData/Roaming/Composer/vendor/psy/psysh/bin:/mnt/c/Go/bin:/mnt/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/mnt/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/mnt/d/Program Files/nodejs:/mnt/d/Program Files/Git/cmd:/mnt/c/Users/Administrator/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Administrator/AppData/Roaming/Composer/vendor/bin:/mnt/d/go/bin:/mnt/d/Program Files (x86)/mingw-w64/x86_64-4.8.2-release-posix-seh-rt_v3-rev2/mingw64/bin:/mnt/c/Users/Administrator/AppData/Roaming/npm:/mnt/d/wsl-terminal-tabbed:/sbin" ldconfig -n /var/www/xhprof/extension/modules
Libraries have been installed in: /var/www/xhprof/extension/modules
If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the '-LLIBDIR' flag during linking and do at least one of the following:
See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages.
Build complete. Don't forget to run 'make test'.
Installing shared extensions: /usr/lib/php/20170718/
直接访问 sample.php 得到如下报错
2019/02/14 10:21:48 [error] 9439#9439: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function xhprof_enable() in /var/www/xhprof/examples/sample.php:17 Stack trace:
0 {main}
thrown in /var/www/xhprof/examples/sample.php on line 17" while reading response header from upstream, client: 127.0.0.1, server: xhprof.com, request: "GET /examples/sample.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "xhprof.com"
问题应该是 xhprof 扩展没有加载到。不知道我哪一步出错了。