尝试在 Mac OS Lion 上的 MAMP 中使用 PECL 安装 OAUTH 时遇到问题
我是设置 php 服务器的新手,我看过其他相关的帖子,似乎没有人有和我一样的错误.我正在使用 MAMP 2.0.2,并运行 PHP 5.3.6,我试图使用以下命令在本地 MAMP 上安装 oAuth:
i am new to setting php servers, and i had go though other related post, seems like nobody have the same error as i have. I am using MAMP 2.0.2, and running PHP 5.3.6, and I was trying to install oAuth on my local MAMP, using following commands:
$ cd /Applications/MAMP/bin/php/php5.3.6/bin
$ ./pecl install oauth
然而,它返回这样的错误:
however, it return such error:
Notice: unserialize(): Error at offset 276 of 1133 bytes in Config.php on line 1050
ERROR: The default config file is not a valid config file or is corrupted.
发生了什么?PECL 捆绑在 MAMP 中,这应该是开箱即用的......
What is happening? PECL is bundled in MAMP, which should be working out of the box....
更新:
我在别处读到一篇文章,表明保存安装路径的配置文件数据不正确,因此我更改了以下文件中的一些值:
I read a post elsewhere suggest that the config file's data, which holds the install paths are in-correct, so i changed some value in the following file :
/Applications/MAMP/bin/php/php5.3.6/conf/pear.conf
然后,我使用命令:
$ ./pecl install oauth
它开始下载和解压,但是当它尝试安装时,它给出:
Which it starts download and unpack, but when it try to install, it gives:
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-user1RU5EZA/oauth-1.2.2/libtool --mode=compile cc -I. -I/private/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-user1RU5EZA/oauth-1.2.2/include -I/private/tmp/pear/temp/pear-build-user1RU5EZA/oauth-1.2.2/main -I/private/tmp/pear/temp/oauth -I/Applications/MAMP/bin/php/php5.3.6/include/php -I/Applications/MAMP/bin/php/php5.3.6/include/php/main -I/Applications/MAMP/bin/php/php5.3.6/include/php/TSRM -I/Applications/MAMP/bin/php/php5.3.6/include/php/Zend -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /private/tmp/pear/temp/oauth/oauth.c -o oauth.lo
mkdir .libs
cc -I. -I/private/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-user1RU5EZA/oauth-1.2.2/include -I/private/tmp/pear/temp/pear-build-user1RU5EZA/oauth-1.2.2/main -I/private/tmp/pear/temp/oauth -I/Applications/MAMP/bin/php/php5.3.6/include/php -I/Applications/MAMP/bin/php/php5.3.6/include/php/main -I/Applications/MAMP/bin/php/php5.3.6/include/php/TSRM -I/Applications/MAMP/bin/php/php5.3.6/include/php/Zend -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /private/tmp/pear/temp/oauth/oauth.c -fno-common -DPIC -o .libs/oauth.o
In file included from /private/tmp/pear/temp/oauth/oauth.c:14:
/private/tmp/pear/temp/oauth/php_oauth.h:20:10:
fatal error: 'php.h' file not found
include "php.h"
^
1 error generated.
make: *** [oauth.lo] Error 1
ERROR: `make' failed
再说一遍,发生了什么?
Again, what is happening?
推荐答案
我知道这是旧的,但我在遇到类似问题时发现了这个问题.
I know this is old but I found this question while having a similar issue.
MAMP 没有附带一堆 PHP 源
MAMP doesn’t ship with a bunch of the PHP sources
- 下载 MAMP 组件并进行配置
- 网址:http://www.mamp.info/en/downloads/index.html(即 MAMP_components_2.0.2.zip)
- 解压您的 MAMP_components_2.0.2.zip
- 确定您的 php-5.x.x.tar.gz 文件(其中 5.x.x 是您的 PHP 版本)
- 如果您使用的是 php > 5.4.10,请从 http://php.net/releases 因为它们不在 MAMP 组件下载中(信用 pulkitsinghal 在评论中)
为您的 PHP 源创建目录:
- Download MAMP components and configure
- URL: http://www.mamp.info/en/downloads/index.html (i.e. MAMP_components_2.0.2.zip)
- Unpack your MAMP_components_2.0.2.zip
- Identify your php-5.x.x.tar.gz file (where 5.x.x is your version of PHP)
- If you are using php > 5.4.10 then download the sources from http://php.net/releases as they are not in the MAMP components download (credit pulkitsinghal in comments)
Create directory for your PHP sources:
mkdir -vp/Applications/MAMP/bin/php5/include
将 php-5.x.x.tar.gz 解压到/Applications/MAMP/bin/php/php5.*/include 或/Applications/MAMP/bin/php5/include:
Untar php-5.x.x.tar.gz into /Applications/MAMP/bin/php/php5.*/include or /Applications/MAMP/bin/php5/ include:
tar zxvf php-5.x.x.tar.gz -C/Applications/MAMP/bin/php/php5.?.??/include
将你的 php-5.x.x 目录重命名为 php(不带版本号):
Rename your php-5.x.x directory to php (without the version numbering):
mv/Applications/MAMP/bin/php/php5.2.17/include/php-5.?.??/应用程序/MAMP/bin/php/php5.2.17/include/php
配置 PHP 源代码(它将创建必要的文件,即 zend_config.h、tsrm_config.h 等):
Configure PHP sources (it’ll create necessary files i.e. zend_config.h, tsrm_config.h, etc.):
cd/Applications/MAMP/bin/php/php5.?.??/include/php
./configure
这个过程是为了另一个修复,但这解决了找不到 php.h 的问题
The process was for another fix but this resolved the issues with php.h not being found
感谢我找到答案的地方 - :
Credit to where I found the answers - :
托马斯亨特博客
Google Doc 详细说明过程
相关文章