I was rebuilding PHP 5.1.4 for my G4 PowerBook to use with Apache 2.2.2 and MySQL 5.* when I ran into this problem using PEAR:
When I would run a command like:
pear install Log
PEAR would download the package, indicate that it was done, and then hang, consuming 100% of the CPU and never do anything more.
I finally tracked down that this seems to be a problem with PHP uncompressing the file (a .tgz). I’m not entirely sure WHY PHP is having this problem, but I did find a workaround solution:
Instead of this:
pear install Log
pear install -Z Log
This requests just the .tar version of the file, which is larger, but doesn’t require the .tgz uncompression. Once I used that command, PEAR worked like it used to (just fine, super quick, actually works, etc…)
P.S. This is the ./configure command that I used to compile PHP:
./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql –with-gd –with-libjpeg=/sw –with-libtiff=/sw –with-mysql=/usr/local/mysql –with-mcrypt –enable-soap –with-curl –enable-trans-sid –enable-ftp –with-ldap –enable-exif –with-mhash –with-openssl –with-zlib –with-ttf –enable-gd-native-ttf –with-zlib-dir=/usr/local/lib/ –with-png-dir=/usr/local/lib/ –with-bz2
I’m not sure if this is an issue with how I compiled PHP, or OS X Tiger, or zlib, or what. I’m glad to have a working PEAR again though even if it isn’t quite as efficient as it would be otherwise.
2 responses to “Fix for PHP PEAR on OS X 100% CPU problem”
If you want to get around having to use -Z, which isn’t that big of a deal, I do have a manual fix to the problem that will most likely work for most OS X machines, and possibly others. It lies in the _jumpBlock method of Archive/Tar.php. gzseek in this instance seems to not perform it’s function, so you can install a loop like bz2 using gzread instead.
Here is the link:
I have been looking for days for the answer to this. you are the man. Thank you.