简体   繁体   English

如何在mac osx mamp上安装apc for php?

[英]how to install apc for php on mac osx mamp?

I am running a mac with mamp and mamp pro. 我正在运行一个带有mamp和mamp pro的mac。 How do I check if I have APC enabled and if its not enabled or not installed how do I install it? 如何检查是否启用了APC,如果未启用或未安装APC如何安装?

I am trying to get the APC upload loader to work that I found online and it gets stuck on NAN% when im uploading. 我试图让APC上传加载程序在网上找到工作,当我上传时它会被困在NAN%上。

This is a link: http://www.haughin.com/2007/10/23/php-upload-progress-with-php-52-apc/ 这是一个链接: http//www.haughin.com/2007/10/23/php-upload-progress-with-php-52-apc/

There's nothing to download or install. 没有什么可下载或安装的。 MAMP 1.9 includes APC already. MAMP 1.9已包含APC。 To enable it, open Preferences/PHP. 要启用它,请打开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'. 取消选中'Zend Optimizer'(因为它与APC不兼容),然后从'Cache'下拉框中选择APC,用'OK'提交更改。

In MAMP 2.1 you can find the APC setting in the Main Window under Server > PHP > Cache: 在MAMP 2.1中,您可以在主窗口中的Server> PHP> Cache下找到APC设置:

在此输入图像描述

In MAMP 3.0 APC is found on the PHP tab: 在MAMP 3.0中,可以在PHP选项卡上找到APC:

在此输入图像描述

对于命令行支持,还要在MAMP php.ini中添加以下行:

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

Do it manually: 手动完成:

1- nano /Applications/MAMP/bin/php/php5.6.2/conf/php.ini 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. 注意:路径上的“ php5.6.2 ”应更改为您将使用的php版本。

2- Look for the section: 2-寻找部分:

[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: 3-删除冒号(;),使该部分显示:

[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) 4-保存(Ctrl-O) + Enter并退出(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. 从控制台(CLI)运行PHP脚本时,您需要指定要使用的PHP二进制文件,因为默认情况下,php将是OS X中包含的默认PHP,而不是与MAMP一起安装的PHP。

So instead of: 所以代替:

 user$ php script.php 

try: 尝试:

 user$ /Applications/MAMP/bin/php/php5.6.2/bin/php script.php 

Visit the phpinfo page that you can get to from inside the MAMP start page. 访问您可以从MAMP开始页面内部访问的phpinfo页面。 That lists all of the loaded modules. 列出了所有已加载的模块。

Here are the install steps for PHP-APC: 以下是PHP-APC的安装步骤:

link text 链接文字

You may be able to run pear or pecl inside MAMP to do the install easily. 您可以在MAMP中运行pearpecl来轻松进行安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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