问题描述
我是设置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
又发生了什么事?
推荐答案
我知道这很旧,但是在遇到类似问题时发现了这个问题.
I know this is old but I found this question while having a similar issue.
- 下载MAMP组件并进行配置
- URL: 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.?.?? /Applications/ MAMP/bin/php/php5.2.17/include/php
mv /Applications/MAMP/bin/php/php5.2.17/include/php-5.?.?? /Applications/ 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 - :
这篇关于尝试在Mac OS Lion上的MAMP中使用PECL安装OAUTH时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!