how to install apc for php on mac osx mamp?
Asked Answered
S

5

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/

Stymie answered 17/6, 2010 at 21:36 Comment(0)
R
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'.

Randarandal answered 16/7, 2010 at 15:0 Comment(1)
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 :)Dandrea
T
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

Turman answered 17/12, 2012 at 2:36 Comment(4)
What if you use MAMP and not MAMP Pro?Cyst
According to the officialy MAMP website, the APC Cache is available in both MAMP and MAMP Pro versions: mamp.info/en/mamp-pro/features/matrix.htmlTurman
MAMP 3.0 solution above is also the same for v3.3 and v3.4Turman
Worth noting that APC is currently not compatible with PHP version 7.0, so the APC option will be greyed out if you have PHP 7.0 selected.Valadez
E
2

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

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

Electroanalysis answered 5/7, 2015 at 14:32 Comment(0)
T
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.

Telemark answered 17/6, 2010 at 21:40 Comment(1)
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()Supersaturated
S
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
Sideways answered 1/5, 2015 at 3:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.