1
votes

I am trying to execute a php file with a specific MAMP php version(/Applications/MAMP/bin/php/php5.3.14/bin/php) . But even though I have enabled APC caching while starting MAMP, apc code are getting error like "Fatal error: Call to undefined function apc_fetch()" . in general running of that script from browser via 'localhost' works fine.

I have also tried by adding 'apc.so' to php.ini file for that php version. But this is generating another error 'Segmentation fault: 11' .

What can I do to get the APC running under that php cli version please? Thanks.

1

1 Answers

3
votes

MAMP uses a different php.ini for CLI. Here's how to find it:

$ php -i | grep php.ini
Configuration File (php.ini) Path => /Applications/MAMP/bin/php/php5.5.10/conf
Loaded Configuration File => /Applications/MAMP/bin/php/php5.5.10/conf/php.ini

In this case you should edit /Applications/MAMP/bin/php/php5.5.10/conf/php.ini and uncomment:

;extension=apcu.so

EDIT: make sure php is the MAMP php and not system php! In doubt use:

$ /Applications/MAMP/bin/php/php5.5.10/bin/php -i | grep php.ini