Or madness in general. So as you may know, I've started using PHPStorm to work locally. I decided to dust off an old SSH2 wrapper I wrote and play with how PHPStorm uses PHPUnit and does refactoring. I knew that I would have to install the extension via PECL and was like, "Oh it can't be that bad to do it through MAMP PRO" and as you may have guessed, I sealed my own fate for a couple hours. One thing I can say is that, even though I use a convenient app like MAMP PRO to set up my local development environment, I'm glad my sysadmin-fu is up to snuff enough to fly without the conveniences because after this ordeal, I feel like I might as well have made my MAMP stack from scratch with all the hoops I jumped tonight. (I'm pretty sure that last sentence is also one of the worst run-on sentences ever).
The first thing you need to know is that the PECL command is located at the directory
/Applications/MAMP/bin/php/php5.3.6/bin
when I tried to run
sudo ./pecl install -a ssh2 channel://pecl.php.net/ssh2-0.11.3
from that directory, I got the error:
Notice: unserialize(): Error at offset 267 of 1133 bytes in Config.php on line 1050 PHP Notice: unserialize(): Error at offset 267 of 1133 bytes in /Applications/MAMP/bin/php/php5.3.6/lib/php/PEAR/Config.php on line 1050 ERROR: The default config file is not a valid config file or is corrupted.
I found out later that the error is most likely caused by the file
/Applications/MAMP/bin/php/php5.3.6/conf/pear.conf
So if you get an error, try doing
sudo mv /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf.bkp
If you're still getting the error, you can also the following:
- Install Xcode Tools from your Mac OS X DVD or download it from Apple Developer Connection
- Download the complete PHP source code from php.net into /Applications/MAMP/bin/php/php5.3.6/
- Create an include directory in the the php5.3.6 directory.
- Unzip/tar the php source archive and move it to/Applications/MAMP/bin/php/php5.3.6/include/
- Rename the php source directory to just php (so then it will look like /Applications/MAMP/bin/php/php5.3.6/include/php)
- In Terminal use the following commands to compile the extension:
cd /Applications/MAMP/bin/php/php5.3.6/include/php
./configure
That should allow you to run the PECL command however, you will probably get a complaint about not having libssh installed. So you will have to
- go download libssh2 [www.libssh2.org] As much as I like git, I recommend downloading the latest release tarball instead of cloning the repo. For some reason, I got a version incompatibility error when trying to run the PECL install with the repo version and had to do all these steps over with the tarball release version.
- unzip the directory and cd to the upacked directory
Truncated by Planet PHP, read more at the original (another 3243 bytes)


