Having problems while try to install OAUTH with PECL in MAMP on mac OS lion
Asked Answered
C

4

27

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?

Chin answered 23/5, 2012 at 10:9 Comment(0)
T
66

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

Topsail answered 24/6, 2012 at 5:29 Comment(8)
This didn't work for me but didn't have time to dig in any further.Andante
thanks a lot - i used this to get the php mongo driver installed with php 5.4.4Teenateenage
If you get the following /Applications/MAMP/bin/php/php5.4.4/include/php/Zend/zend.h:51:11: fatal error: 'zend_config.h' file not found make sure you configure php sources. i.e. in the directory where you copied all the files run ./configureJervis
Well i'm using MAMP 2.2 now, where do i get the component.zip??Philbert
the only tweak is that MAMP_components_2.1.2 didn't have the zip for php5.5.3 so that had to be retrieved from php.net/releases instead.Forevermore
Thanks a lot man. You saved my life. I used this structure to get mongo driver installed with php 5.5.26Fossette
I was so sure this would work... but after running ./configure: configure: error: build test failed. Please check the config.log for details. dl.dropboxusercontent.com/u/17428145/config_log.txtStansberry
I would really like to try this solution but I cant seem to find the MAMP_component zip file, When I go to the url suggested all i get is a pkg fileOmarr
M
30

I had the same problem whilst trying to pecl install -f ssh2 with MAMP.

Here's how I fixed it:

  1. MAMP doesn't provide the source code archive for PHP 5.4.10 so download it from php.net
  2. Extract the source code archive to /Applications/MAMP/bin/php/php5.4.10/include/php
  3. Run ./configure to configure the source code for your platform (without this step the pecl install will fail looking for a bunch of header files)
  4. Retry your pecl install

(much thanks to Stephen's answer which is pretty much the same)

Mothering answered 11/4, 2013 at 1:8 Comment(3)
This is the simpler answer. One thing to note: rename the uncompressed PHP 5.4.10 folder to simply php after placing it into the /include directory, I was confused about that step.Greek
This answer should be accepted, it fixes the issue, is clearly explained and I guess it will work for a long time. Not like the most voted one.Bilyeu
But running these commands in the terminal don't affect the MAMP installation but the system installation of PHP which doesn't appear to help me.Mcreynolds
H
6

This is a complement to Stephen's answer and Greg's comment

When compiling xdebug 2.3.2 for php 5.6.2 on OSX 10.10.2, I could not get rid of the

'zend_config.h' file not found

error until I added the following option to ./configure in the php folder:

./configure --without-iconv

Credits to Cameron Browning

Horary answered 5/4, 2015 at 2:33 Comment(0)
H
1

PECL Modules are compiled modules, in order to install them, you need the PHP headers. You can found the headers on php.net/downloads.php make sure you download a version which match with your PHP version. Then you can follow this : Installing PHP OAuth in MAMP environment

Hearsay answered 18/6, 2014 at 0:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.