11

I am running a mac with mamp and mamp pro. How do I check if I have APC enabled and if its not enabled or not installed how do I install it?

I am trying to get the APC upload loader to work that I found online and it gets stuck on NAN% when im uploading.

This is a link: http://www.haughin.com/2007/10/23/php-upload-progress-with-php-52-apc/

T. Junghans
  • 11,385
  • 7
  • 52
  • 75
michael
  • 329
  • 2
  • 4
  • 10

5 Answers5

24

There's nothing to download or install. MAMP 1.9 includes APC already. To enable it, open Preferences/PHP. Uncheck 'Zend Optimizer' (because it's not compatible with APC), then choose APC from the 'Cache' drop-down box, submit the change with 'OK'.

keithm
  • 2,813
  • 3
  • 31
  • 38
  • and 4 years later this still works. I don't see Zend optimizer but you can go to Preferences -> PHP -> Cache -> APC and it works all fine :) – caramba Aug 08 '14 at 08:31
17

In MAMP 2.1 you can find the APC setting in the Main Window under Server > PHP > Cache:

enter image description here

In MAMP 3.0 APC is found on the PHP tab:

enter image description here

Andrew
  • 3,335
  • 5
  • 36
  • 45
2

For command-line support add also the following lines to your MAMP php.ini:

[apc] extension=apcu.so apc.enable_cli=1

ksn135
  • 1,412
  • 1
  • 11
  • 14
0

Do it manually:

1- nano /Applications/MAMP/bin/php/php5.6.2/conf/php.ini

NOTE: "php5.6.2" on the path should be changed to the php version you'll be using.

2- Look for the section:

[OPcache] ;zend_extension="/Applications/MAMP/bin/php/php5.6.2/lib/php/extensions/no-debug-non-zts-20131226/opcache.so"

3- Remove the colon (;) so that section reads:

[OPcache] zend_extension="/Applications/MAMP/bin/php/php5.6.2/lib/php/extensions/no-debug-non-zts-20131226/opcache.so"

4- Save (Ctrl-O) + Enter and quit (Ctrl-X)

Enjoy.

When running PHP scripts from the Console (CLI) you will need to specify the PHP binary you want to use since by default php will be the default PHP included with OS X, not the one installed with MAMP.

So instead of:

user$ php script.php

try:

user$ /Applications/MAMP/bin/php/php5.6.2/bin/php script.php
Meetai.com
  • 6,622
  • 3
  • 31
  • 38
0

Visit the phpinfo page that you can get to from inside the MAMP start page. That lists all of the loaded modules.

Here are the install steps for PHP-APC:

link text

You may be able to run pear or pecl inside MAMP to do the install easily.

Peter Loron
  • 1,156
  • 10
  • 15
  • I am having the same issue, I was able to install APC using `pecl install APC` After installation I was able to grab the apc.so file: `/opt/local/lib/php/extensions/no-debug-non-zts-20090626/apc.so` and replace the `/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/apc.so` file. I think im on the right track, but when rebooting apache it no longer says apc is installed when using `phpinfo()` – Shawn Northrop May 30 '13 at 00:39