Tuesday, January 25, 2011

Trouble installing php memcache extension

I'm trying to install memcache on MAMP but I get the warning below, and when I continue it seems to complete properly. I add the line extension=memcache.so to the php.ini and restart MAMP but phpinfo() doesn't list the memcache extension.

$ ./pecl install memcache
downloading memcache-2.2.5.tgz ...
Starting to download memcache-2.2.5.tgz (35,981 bytes)
..........done: 35,981 bytes
11 source files, building
WARNING: php_bin /Applications/MAMP/bin/php5/bin/php appears to have a suffix 5/bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
Enable memcache session handler support? [yes] : yes

...

Build process completed successfully
Installing '/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/memcache.so'
install ok: channel://pecl.php.net/memcache-2.2.5
configuration option "php_ini" is not set to php.ini location
You should add "extension=memcache.so" to php.ini
  • hey .. i am running into same problem. did you find anything on this ??

  • Not really an answer. I just can't comment so I'm posting here. I have apache + php installed via darwin ports. apache from ports is not enabled. I have installed MAMP version 1.9 and I'm trying to build the memcache extension into PHP 5.3.2.

    I'm following the option 2 instructions for building the memcache PHP extension for MAMP at http://www.lullabot.com/articles/setup-memcached-mamp-sandbox-environment.

    When I go to build memcached from

    /Applications/MAMP/bin/php5.3/bin/pecl

    I get output that seems to indicate that pecl is building for the PHP extension directory previously installed via darwin ports:

    WARNING: php_bin /Applications/MAMP/bin/php5/bin/php appears to have a suffix 5/bin/php, but config variable php_suffix does not match
    building in /var/tmp/pear-build-bmillett/memcache-2.2.5
    running: /private/tmp/pear/temp/memcache/configure --enable-memcache-session=yes
    ...
    checking for PHP prefix... /usr
    checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
    checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20060613
    

    eventually I end up with:

    installing '/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so' ERROR: failed to write /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so (copy(/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so): failed to open stream: Permission denied)

    Just for fun, I ran pecl via sudo and grabbed the extension module that was built (for the wrong source it would seem.) When I stuck it in my MAMP extension folder and configured it in php.ini, I get this error:

    [18-Jun-2010 15:38:00] PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20060613 PHP compiled with module API=20090626 These options need to match

    Is there anyway to specify from which config and to where to build this module? Any enlightenment would be great.

    Thanks

    From Bretticus
  • Okay,

    Here's how I got this to install via pecl:

    I had installed PHP via darwin ports. When php-config was called, it was calling that file for my PHP 5.2.x installation.

    1. I added a directory to my MAMP installation: mkdir /Applications/MAMP/bin/php5
    2. Depending on which version of PHP I'm running, I link the bin folder. In this instance of building for version 5.3.2, from within the new php5 dir: ln -s ../php5.3/bin
    3. Now, update or modify path from your ~/.profile file: export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php5/bin/:$PATH
    4. MAMP doesn't set the execute bit on php-config for some reason: so cd to the php5/bin folder: chmod +x php-config
    5. Now just run pecl: sudo ./pecl i memcache
    From Bretticus

0 comments:

Post a Comment