开发者

Installing the Pecl Oauth Module on MAMP OSX 10.6

开发者 https://www.devze.com 2023-01-24 04:15 出处:网络
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.

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-2009062开发者_StackOverflow6/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


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.


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


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


sudo /Applications/MAMP/bin/php/php7.4.12/bin/pear install HTTP_OAuth-0.3.2

use the above command to install Oauth libraries in MAMP

And then You should add "extension=oauth.so" to php.ini

Restart Server After Add extension in php.ini file

0

精彩评论

暂无评论...
验证码 换一张
取 消