Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7 support #82

Closed
langemeijer opened this issue Feb 9, 2016 · 21 comments
Closed

PHP 7 support #82

langemeijer opened this issue Feb 9, 2016 · 21 comments

Comments

@langemeijer
Copy link

With the introduction of PHP 7 the phpapi has changed a bit. As a result xhprof won't compile when phpized with the PHP 7.0 phpize.

Is someone planning to do PHP 7 support?

@langemeijer
Copy link
Author

I just stumbled upon https://github.com/RustJason/xhprof/tree/php7 and will try to give it a spin.

@kleijnweb
Copy link

@langemeijer how is that working out for you?

@langemeijer
Copy link
Author

I have a big number of other extensions to compile before I can do any testing in a staging environment, because my application has a large number of dependencies. I can tell that it compiles correctly on my build system. (debian jessie with php 7.0.2)

@rustjson
Copy link

@langemeijer feel free to let me know if you have any issues.

@aftabalamdev99
Copy link

aftabalamdev99 commented May 18, 2016

Hello. I am using windows. I want an xhprof profiling tool for php7. Please inform me about xhprof dll release for php7. I am not expert in xhprof but I am learning it. Please release xhprof as soon as possible for windows user.

@senvys
Copy link

senvys commented Aug 10, 2016

xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
Do not display CPU and memory information,why?

@udoless
Copy link

udoless commented Oct 31, 2016

Hi, xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY) doesn't work in php7, is it a bug?

@lav45
Copy link

lav45 commented Oct 31, 2016

@udoless

xhprof_enable(XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);

@poolerMF
Copy link

poolerMF commented Dec 1, 2016

@udoless , @lav45 it doesn't matter if "|" or "+"

const XHPROF_FLAGS_NO_BUILTINS = 1;
const XHPROF_FLAGS_CPU = 2;
const XHPROF_FLAGS_MEMORY = 4;

so you can call xhprof_enable(7) .. or xhprof_enable(6), you do not need to use constants

@udoless try to use https://github.com/longxinH/xhprof ... it's working for me (ubuntu 16.04, php7)

git clone https://github.com/longxinH/xhprof
cd xhprof/extension
phpize
./configure --with-php-config=/usr/bin/php-config7.0
sudo make && sudo make install

@mallardduck
Copy link

The fork from @RustJason seems to work for me on Arch with PHP7

@cr-solutions
Copy link

cr-solutions commented Mar 10, 2017

I have the same problem, no display of CPU and memory (Debian Jessie with PHP 7.1)
If I use the fork master I get an error on make and with the fork
https://github.com/RustJason/xhprof/tree/php7
I also not see CPU and memory

But version https://github.com/longxinH/xhprof seems working

@lsa-github
Copy link

lsa-github commented Apr 13, 2017

Its working.
ubuntu 16.04
nginx php7.0-fpm

git clone https://github.com/longxinH/xhprof
cd xhprof/extension
phpize (if is not found command then sudo apt-get install php7.0-dev)
./configure --with-php-config=/usr/bin/php-config7.0
sudo make && sudo make install

sudo vim /etc/php/7.0/fpm/php.ini
(if console app sudo vim /etc/php/7.0/cli/php.ini)
[xhprof]
extension=xhprof.so
xhprof.output_dir="/tmp/xhprof"

sudo service php7.0-fpm restart

#your script.php

xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);

....
#your code
....

$xhprof_data = xhprof_disable();
include_once  '/var/www/xhprof/xhprof_lib/utils/xhprof_lib.php';
include_once  '/var/www/xhprof/xhprof_lib/utils/xhprof_runs.php';
$xhprof_runs = new \XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, 'your_project');
echo "<a href='http://xhprof/index.php?run={$run_id}&source=your_project' target='_blank'>profile</a>";
#http://xhprof is my localhost

result
Overall Summary
Total Incl. Wall Time (microsec): 9,412 microsecs
Total Incl. CPU (microsecs): 4,000 microsecs
Total Incl. MemUse (bytes): 1,619,896 bytes
Total Incl. PeakMemUse (bytes): 1,494,016 bytes
Number of Function Calls: 3,471
...

@sankalpsans
Copy link

sankalpsans commented Dec 22, 2017

For those looking, here are the steps for PHP 7.1 (modified the snippets shared by @Slihotin )

git clone https://github.com/longxinH/xhprof
cd xhprof/extension
phpize (if is not found command then sudo apt-get install php7.1-dev)
./configure --with-php-config=/usr/bin/php-config7.1
sudo make && sudo make install

Then modify the ini files /etc/php/7.1/fpm/php.ini or the module files separately if that's how you do it to add the following lines

[xhprof]
extension=xhprof.so
xhprof.output_dir="/tmp/xhprof"

sudo service php7.1-fpm restart

@katzien
Copy link

katzien commented Feb 3, 2018

I came across this recently - https://tideways.io/profiler/xhprof-for-php7

@andypost
Copy link

andypost commented Feb 3, 2018

Btw new release of xdebug mostly replacement for xhprof now

@ihorvorotnov
Copy link

@andypost in what way? I'm following xdebug 2.6 development, not sure what you mean though.

@andypost
Copy link

@ihorvorotnov I see no reason in xhprof after 2.6 release of xdebug fixed memory usage in profiling

@ihorvorotnov
Copy link

ihorvorotnov commented Feb 10, 2018

@andypost What about comparing multiple runs? Also xdebug is much more resource intensive and shouldn’t be used on production. Both have a bit different purposes.

@andypost
Copy link

Good point about live! OTOH maybe easy to make xdebug less involved in eating cpu or do that on demand ... cos here only 2 forks & tideways vs blackfire

@andypost
Copy link

After checking code in new https://github.com/tideways/php-xhprof-extension/tree/v5.0-beta1 I think it looks much cleaner comparing to https://github.com/longxinH/xhprof/tree/master/extension

@epriestley
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests