php 无法在 OS X 10.9 Mavericks 中 phpize 或配置扩展

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19531262/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 19:39:52  来源:igfitidea点击:

Can't phpize or configure an extension in OS X 10.9 Mavericks

phpmacosphp-extensionosx-mavericks

提问by donatJ

I am trying to build the memcached extension on OS X 10.9 Mavericks for use with the built in PHP 5.4, initially I tried pecl install memcachedbut that threw the following.

我正在尝试在 OS X 10.9 Mavericks 上构建 memcached 扩展以与内置的 PHP 5.4 一起使用,最初我尝试过pecl install memcached但抛出了以下内容。

checking for zlib location... configure: error: memcached support requires ZLIB. Use --with-zlib-dir=<DIR> to specify the prefix where ZLIB headers and library are located
ERROR: `/private/tmp/pear/install/memcached/configure' failed

So I created a tmp directory and executed pecl download memcached, unzipped the code and cd'd to the appropriate directory.

所以我创建了一个 tmp 目录并执行pecl download memcached,解压代码并 cd 到适当的目录。

Trying to phpize it returned the following:

尝试对其进行 phpize 返回以下内容:

grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No:  

I had brew installed zlib a while ago and pointed ./configure at my installation. ./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8I was greeted with the following error message:

不久前我 brew 安装了 zlib 并在我的安装中指向 ./configure 。 ./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8我收到了以下错误消息:

checking for session includes... configure: error: Cannot find php_session.h

So now I'm wondering the best course of action here... /usr/include/doesn't exist at all... is this a Mavericks thing? I don't remember having this problem in 10.8 at all.

所以现在我想知道这里最好的行动方案....../usr/include/根本不存在......这是小牛队的事情吗?我不记得在 10.8 中有这个问题。

I could try brew installing php-develbut I presume that isn't going to be the right version of what I need? Any help would be greatly appreciated here

我可以尝试 brew 安装,php-devel但我认为这不是我需要的正确版本?任何帮助将不胜感激在这里

Update

更新

locate php_session.hreveals

locate php_session.h显示

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/php/ext/session/php_session.h

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/php/ext/session/php_session.h

should I just ln -sthis to the expected location or is there some way to do this via XCode? I have the command line tools installed...

我应该把ln -s它放到预期的位置,还是有什么方法可以通过 XCode 做到这一点?我已经安装了命令行工具...

回答by afessler

run xcode-select --installto install the XCode5 Command Line Tools, then sudo pecl install memcache. You should be good to go.

运行xcode-select --install以安装 XCode5 命令行工具,然后sudo pecl install memcache. 你应该很高兴去。

回答by haroK

After install XCode5 Command Line Tools as afessler sugest (xcode-select --install) I couldn't do the "sudo pecl install memcache" because pecl was missing. I had to install PEAR and PECL following this guide: http://techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/. Then all worked good. Thanks!

将 XCode5 命令行工具安装为 afessler sugest (xcode-select --install) 后,我无法执行“sudo pecl install memcache”,因为缺少 pecl。我必须按照本指南安装 PEAR 和 PECL:http: //techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/。然后一切都很好。谢谢!

回答by Jonny White

I had this problem and it was due to MAMP not having all the PHP sources.

我遇到了这个问题,这是由于 MAMP 没有所有的 PHP 源。

I found this really helpful solution that explains how to download and configure them: https://stackoverflow.com/a/11175197/369326

我发现这个非常有用的解决方案解释了如何下载和配置它们:https: //stackoverflow.com/a/11175197/369326

Note that the MAMP components doesn't include the extras for any versions of PHP higher than php 5.4.10 but you can download the extras from http://php.net/releases.

请注意,MAMP 组件不包含高于 php 5.4.10 的任何 PHP 版本的附加功能,但您可以从http://php.net/releases下载附加功能。

回答by Julio Marins

As said above but not using xcode install Try installing pecl manually:

如上所述但不使用 xcode install 尝试手动安装 pecl:

  curl -O http://pear.php.net/go-pear.phar 
  sudo php -d detect_unicode=0 go-pear.phar 

and then:

进而:

 sudo pecl install memcache

See more at: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/#sthash.x2LKdqj6.dpuf

查看更多信息:http: //jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/#sthash.x2LKdqj6.dpuf