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

@langemeijer langemeijer commented Feb 9, 2016

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

@langemeijer langemeijer commented Feb 9, 2016

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

@kleijnweb
Copy link

@kleijnweb kleijnweb commented Feb 15, 2016

@langemeijer how is that working out for you?

@langemeijer
Copy link
Author

@langemeijer langemeijer commented Feb 15, 2016

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

@rustjson rustjson commented Mar 30, 2016

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

@aftabalamdev99
Copy link

@aftabalamdev99 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 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 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 lav45 commented Oct 31, 2016

@udoless

xhprof_enable(XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);
@poolerMF
Copy link

@poolerMF 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

@mallardduck mallardduck commented Dec 29, 2016

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

@cr-solutions
Copy link

@cr-solutions 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 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 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 katzien commented Feb 3, 2018

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

@andypost
Copy link

@andypost andypost commented Feb 3, 2018

Btw new release of xdebug mostly replacement for xhprof now

@ihorvorotnov
Copy link

@ihorvorotnov ihorvorotnov commented Feb 5, 2018

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

@andypost
Copy link

@andypost andypost commented Feb 10, 2018

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

@ihorvorotnov
Copy link

@ihorvorotnov 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

@andypost andypost commented Feb 10, 2018

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

@andypost andypost commented Feb 13, 2018

@epriestley epriestley closed this Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.