English 中文(简体)
在试图在MAMP中安装有问题且在MAMP中安装有PECL的AUTH和APTH(在MAMP中安装有问题)
原标题: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

然而,它退回了这种错误:

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里,应该从盒子里...

更新 :

我从别处读到一篇文章, 表示保留安装路径的配置文件 s 数据不正确, 所以我在以下文件中更改了某些值 :

/Applications/MAMP/bin/php/php5.3.6/conf/pear.conf

然后,我使用命令:

$ ./pecl install oauth

开始下载和拆包, 但是当它尝试安装时, 它提供:

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

再说一遍,发生什么事了?

问题回答

我知道这是老问题,但我发现这个问题时也有类似问题。

MAMMP并不拥有许多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)
  • 为您的 PHP 来源创建目录 :

    mkdir -vp/Applications/MAMP/bin/php5/ 包括

  • 将无php-5.x.tar.gz编入/应用程序/MAMP/bin/php/php5.* 包括或/应用程序/MAMP/bin/php5/包括:

    tar zxvf php-5.x.x.tar.gz.gz -C/应用程序/MAMP/bin/php/php5.???" /包括

  • 将您的 php-5. x. x 目录重命名为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 等 ) :

    cd/Applications/MAMP/bin/php/php5.? >?/包括/php

    ./configure

此进程是用于另一个修正, 但这解决了找不到php.h 的问题 。

感谢我找到答案的地方:

"http://thomashunter.name/blog/blog/getting-the-php-mongodb-driver-driver-安裝- with-amp-on-os-x/" rel="noreferrer" >Thomas Hunter Blog

"http://thomashunter.name/blog/blog/getting-the-php-mongodb-driver-driver-安裝- with-amp-on-os-x/" rel="noreferer" >Google Doc 详细程序

在尝试使用 MAMP 安装 < code> pecl -f ssh2 时,我也有同样的问题。

在这里,我如何修补它:

  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

(多亏了史蒂芬的回答 这几乎是一样的)

这是对Stephen 回答和Greg 评论的补充

在编集 OSX 10.10.2 上的 php 5.6.2 xdebug 2.3.2 时,我无法摆脱

找不到 zend_ config.h 文件

错误, 直到我在 php 文件夹中添加以下选项到./ configure :

./configure -- -- 无象素

PECL 模块是编译模块, 要安装模块, 您需要 PHP 信头。 您可以在 php. net/ downloads.php 上找到信头。 您可以在 php. net/ downloads. php 上找到信头, 请确保下载一个与您的 PHP 版本相匹配的版本 。 然后您可以跟踪 : < a href=" https:// stackoverflow. com/ queseseses/ 5413380/安裝-php- oauth- in- mamp- environment/ 24275145" >Instaling PHP OAuth in MAP 环境





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...