WAMP + CodeIgniter + Sparks

I was recently decided to give the Get Sparks project a try. If you are not familiar with the Get Sparks project for Codeigniter, it allows you to download packages/modules for quickly installing into your app. Similar to the idea with PEAR extensions for PHP. I am setting this up on my Windows box using WAMP. I followed the setup instructions from the Get Sparks website, and everything went perfectly fine. I decided to download the popular spark “curl”, and kept getting the:

"You have to install PECL ZipArchive or `unzip` to install this spark."

I kept checking in my php.ini file that php_zip.dll was enabled.  Hmmm…..

So, I decided to create a test script to test the code that was creating this error message. Running the PHP script in the browser ran ZipArchive() successfully. Next, I ran this test PHP script from the command line (CLI). I got a “Fatal Error:  Class ZipArchive not found in …” error. I couldn’t quite figure out why PHP was throwing an error on the CLI and not when run in the browser. A little digging found that PHP run from the command line uses relative paths including php.ini. This the part where WAMP comes into play. For those using WAMP, your php.ini file that is used is located in C:\wamp\bin\apache\Apache2.2.11\bin not where PHP is being executed from. Ah ha! So I went and opened C:\wamp\bin\php\php5.2.9-2 and scrolled down to find:


So I changed this to:

php tools\spark install -v1.2.0 curl

Enabling php_zip.dll in the PHP folder of WAMP, and ran the Sparks command again. Success! The spark was downloaded, unzipped, and installed with no more error.