简体   繁体   中英

How To Use APC with MAMP PHP Command Line?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM