Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
377 views
in Technique[技术] by (71.8m points)

php - Having problems while try to install OAUTH with PECL in MAMP on mac OS lion

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.

What is happening? PECL is bundled in MAMP, which should be working out of the box....

Update:

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

Then, i use the command:

$ ./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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I know this is old but I found this question while having a similar issue.

MAMP doesn’t ship with a bunch of the PHP sources

  • 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

  • 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

  • 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

  • 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

The process was for another fix but this resolved the issues with php.h not being found

Credit to where I found the answers - :

Thomas Hunter Blog

Google Doc detailing process


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...