Tuesday, January 11, 2011

How to fix "cannot run C compiled programs" when installing an extension with pecl


It took me a while to figure out how to install this extension so I thought I'd do a quick post about it. These instructions are probably valid for other PECL extensions but since this is the only one I have installed I wouldn't like to say for sure.

Installation on Unix/Mac

Please note: These instructions are only valid if you have problems running $ pecl install uploadprogress.
  1. Extract the uploadprogress-1.x.x.tgz archive, cd into the extracted folder and run these commands in Terminal:
    $ phpize            # prepares the PHP extension for compiling
    ./configure
    $ make
    $ sudo make install
  2. Check that the directory for the extensions is correct. The last line of the output returned from the $ make install command (on my system) is:
    Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20060613/.
    Open php.ini and edit the extension_dir directive, replacing it with this path.
  3. Add the extension to php.ini by adding this line extension=uploadprogress.so
  4. Restart apache
You should now have the PECL uploadprogress extension installed.

No comments:

Post a Comment