php-memory-profiler
php-memory-profiler copied to clipboard
Where is the extension file?
Description
I'm sorry this seems like a dumb question, but I can't find the extension file anywhere. I did the brew install which appeared to work fine
Jacaranda:trunk murraycollingwood$ brew install traildb/judy/judy
==> Downloading https://downloads.sourceforge.net/project/judy/judy/Judy-1.0.5/Judy-1.0.5.tar.gz
Already downloaded: /Users/murraycollingwood/Library/Caches/Homebrew/downloads/811cf99b7c77d4f35a25ce2e232e5f8f8bc1eb030a8f08ee09317475108af72a--Judy-1.0.5.tar.gz
==> Installing judy from traildb/judy
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 13.3.
==> ./configure --prefix=/opt/homebrew/Cellar/judy/1.0.5
==> make install
🍺 /opt/homebrew/Cellar/judy/1.0.5: 104 files, 1.4MB, built in 33 seconds
==> `brew cleanup` has not been run in the last 30 days, running now...
I then added the extension to the php.ini file:
extension=memprof.so
And lastly, when I run my php unit test:
Warning: PHP Startup: Unable to load dynamic library 'memprof.so' (tried: /opt/homebrew/lib/php/pecl/20210902/memprof.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/memprof.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20210902/memprof.so' (no such file), '/usr/local/lib/memprof.so' (no such file), '/usr/lib/memprof.so' (no such file)), /opt/homebrew/lib/php/pecl/20210902/memprof.so.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/memprof.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20210902/memprof.so.so' (no such file), '/usr/local/lib/memprof.so.so' (no such file), '/usr/lib/memprof.so.so' (no such file))) in Unknown on line 0
Was it my xcode / clt being slightly out of date? Was it something in the brew? Or did it all work and I'm just looking in the wrong directory?
Cheers Murray
php-memprof Version
judy 1.0.5
PHP Version
PHP 8.1
Operating System
OSX 12.2
I'm re-reading through the install instructions, and I can see libJudy is defined as a Dependency.
So I'm thinking now the libJudy is included when compiling the memprof library.
So now I'm running the pecl install memprof
command. It's working till I get to the point where I'm looking for Judy.h
checking whether to enable memprof support... yes, shared
checking for judy lib... yes, shared
checking for include/Judy.h in /usr/local /usr... not found
configure: error: Please install lib judy
ERROR: `/private/tmp/pear/temp/memprof/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config' failed
So then I copy Judy.h to /usr/local/include/Judy.h
I then rerun the pecl install memprof
thinking this should get further, but it doesn't...
checking whether to enable memprof support... yes, shared
checking for judy lib... yes, shared
checking for include/Judy.h in /usr/local /usr... not found
configure: error: Please install lib judy
ERROR: `/private/tmp/pear/temp/memprof/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config' failed
Looks just the same - I'm not making any progress on this.
Cheers Murray
Hi
Currently the pecl package doesn't support specifying a custom libjudy install path.
The manual install method will work: https://github.com/arnaud-lb/php-memory-profiler#installing-manually
@arnaud-lb
The instructions aren't entirely clear - there are a lot of assumptions involved:
Download the source and run the following commands in the source directory:
- This assumes just using the download option from the 'Code' button on this page. That's an easy assumption.
- Next - there are checkout options with git or svn, or download the zip. Again, I'm going to assume we are downloading the zip file.
- Where should I extract this - generally I'm using brew to build all of these things... but I'm not aware that is an option. Is it? So I'm going to assume that I will just stick in my home folder somewhere and build it there.
-
phpize
seems to work, although there was one warningconfigure.ac:161: warning: The macro
AC_TRY_LINK' is obsolete.` - The
./configure
required the one where I specified the path to Judy/1.0.5, it seems to work. -
make
seems to work, again a warningwarning: No support for malloc hooks, this build will not track persistent allocations [-W#warnings]
-
make install
appears to install the library in the correct folder. - Assume we need to restart Apache2 - restarts okay.
- Ran phpinfo() but there is no indication of memprof or Judy. Assuming we should now add the library to the php.ini file. Added
extension=memprof.so
to the php.ini file and restart Apache2 again. It now appears in the phpinfo()
I hope you don't mind - but I've added this detail to help others, like me, who may need a few more instructions to get this working. Thanks for your help.
Now, to turn it on in my script and start working out my memory leaks.
Thank you for the details !
Happy debugging :)