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

Comments

Projects
None yet
@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

This comment has been minimized.

Show comment
Hide comment
@langemeijer

langemeijer Feb 9, 2016

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

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

This comment has been minimized.

Show comment
Hide comment
@kleijnweb

kleijnweb Feb 15, 2016

@langemeijer how is that working out for you?

kleijnweb commented Feb 15, 2016

@langemeijer how is that working out for you?

@langemeijer

This comment has been minimized.

Show comment
Hide comment
@langemeijer

langemeijer 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)

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)

@rustjason

This comment has been minimized.

Show comment
Hide comment
@rustjason

rustjason Mar 30, 2016

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

rustjason commented Mar 30, 2016

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

@aftabalamdev99

This comment has been minimized.

Show comment
Hide comment
@aftabalamdev99

aftabalamdev99 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.

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

This comment has been minimized.

Show comment
Hide comment
@senvys

senvys Aug 10, 2016

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

senvys commented Aug 10, 2016

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

@udoless

This comment has been minimized.

Show comment
Hide comment
@udoless

udoless Oct 31, 2016

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

udoless commented Oct 31, 2016

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

@lav45

This comment has been minimized.

Show comment
Hide comment
@lav45

lav45 Oct 31, 2016

@udoless

xhprof_enable(XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);

lav45 commented Oct 31, 2016

@udoless

xhprof_enable(XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);
@poolerMF

This comment has been minimized.

Show comment
Hide comment
@poolerMF

poolerMF 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

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

This comment has been minimized.

Show comment
Hide comment
@mallardduck

mallardduck Dec 29, 2016

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

mallardduck commented Dec 29, 2016

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

@cr-solutions

This comment has been minimized.

Show comment
Hide comment
@cr-solutions

cr-solutions 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

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

@slihotin

This comment has been minimized.

Show comment
Hide comment
@slihotin

slihotin 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
...

slihotin 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

This comment has been minimized.

Show comment
Hide comment
@sankalpsans

sankalpsans 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

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

This comment has been minimized.

Show comment
Hide comment
@katzien

katzien commented Feb 3, 2018

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

@andypost

This comment has been minimized.

Show comment
Hide comment
@andypost

andypost Feb 3, 2018

Btw new release of xdebug mostly replacement for xhprof now

andypost commented Feb 3, 2018

Btw new release of xdebug mostly replacement for xhprof now

@ihorvorotnov

This comment has been minimized.

Show comment
Hide comment
@ihorvorotnov

ihorvorotnov Feb 5, 2018

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

ihorvorotnov commented Feb 5, 2018

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

@andypost

This comment has been minimized.

Show comment
Hide comment
@andypost

andypost Feb 10, 2018

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

andypost commented Feb 10, 2018

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

@ihorvorotnov

This comment has been minimized.

Show comment
Hide comment
@ihorvorotnov

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

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

This comment has been minimized.

Show comment
Hide comment
@andypost

andypost 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 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

This comment has been minimized.

Show comment
Hide comment
@andypost

andypost commented Feb 13, 2018

@epriestley

This comment has been minimized.

Show comment
Hide comment

@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