Installing the Pecl Oauth Module on MAMP OSX 10.6

*爱你&永不变心* 提交于 2019-12-12 01:33:45

问题


Ok, so after a day of messing about with various things such as Fink, Macports, Pecl, etc. I have managed to install the oauth.so module on OSX.

However, I use MAMP locally, which I think uses its own version (i.e. in its own location) of PHP, and the module has installed to the main system version of PHP?

So I have run the version of PECL from the MAMP folders:

sudo /Applications/MAMP/bin/php5.2/bin/pecl install oauth

But it seems to have installed it in the generic folder anyway

    ...
    Build process completed successfully
    Installing '/usr/lib/php/extensions/no-debug-non-zts-20090626/oauth.so'
    install ok: channel://pecl.php.net/oauth-1.0.0
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=oauth.so" to php.ini

Note the /usr/lib/... folder. But the php.ini MAMP is using, actually looks in /Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613

I thought it would be as easy as just copying the .so file over... but that was hoping for too much..

Can anyone help me, how can I install this extension in the correct folder and let php know about it??

Thanks


回答1:


I'm running MAMP Version 1.9.6 on Mac OSX Version 10.7.4 and had the same problem.

I checked my MAMP php error logs at /Applications/MAMP/logs/php_error.log

and found this error

[22-Jul-2012 12:11:20] PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/oauth.so' - dlopen(/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/oauth.so, 9): no suitable image found.  Did find:
        /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/oauth.so: mach-o, but wrong architecture in Unknown on line 0

I fixed it with the following:

  1. Download source from http://pecl.php.net/package/oauth

    Open up a terminal, navigate to where your downloaded file is and type the following commands:

  2. tar xzvf oauth-1.1.0.tgz

  3. cd oauth-1.2.2/oauth-1.2.2

  4. phpize

  5. sudo ./configure MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS="-arch i386 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -g -Os -pipe" CXXFLAGS="-arch i386 -g -Os -pipe" LDFLAGS="-arch i386 -bind_at_load"

    NOTE: Make sure you type the right version number of your Mac OSX for the TARGET in the above command.

  6. sudo make

  7. sudo make install

  8. sudo cp /usr/lib/php/extensions/no-debug-non-zts-20090626/oauth.so /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/oauth.so

  9. In your favorite editor, open up php.ini (in my case its located at /Applications/MAMP/conf/php5.3/php.ini) and add the following line in the extensions area:

    extension=oauth.so

  10. Save your changes and restart MAMP. You should see an oauth entry in the MAMP PHPINFO page.




回答2:


You should set the php_ini setting of pecl to point to the php.ini of your MAMP installation. So:

sudo /Applications/MAMP/bin/php5.2/bin/pecl config-set /Applications/MAMP/conf/php.ini

This should make pecl use your current MAMP php configuration




回答3:


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



来源:https://stackoverflow.com/questions/4145789/installing-the-pecl-oauth-module-on-mamp-osx-10-6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!