简体   繁体   中英

Installing OAuth PECL package on PHP 5 on OS X

I'm trying to install the OAuth PECL package, and I'm using PHP 5.
When I run the install command, I get the error below that I must have PHP version 7.0.
Upgrading to PHP 7 is not an option right now, so how do I get the OAuth package installed for PHP 5?

chris$ sudo pecl install oauth
pecl/oauth requires PHP (version >= 7.0.0), installed version is 5.5.29
No valid packages found
install failed

It seems like the dependencies are messed up for Version 2.0.0 of oauth . You can install the previous version like this:

sudo pecl install oauth-1.2.3

I also filed an issue on their GitHub project on your behalf ( here ), as this seems to be an unintentional bug.

In package.xml , we have:

<required>
  <php>
    <min>7.0.0</min>
  </php>

  <!-- ... -->
</required>

Edit

Looks like there's some news from the bug report. Indeed, version 2.0.0 only supports PHP7 and the changelog was unclear. The maintainer of oauth has filed a bug against PECL to install the latest compatible version. So, yes, you're stuck with 1.2.3 and the instructions above are correct.

Edit Again

It looks like PECL won't be fixing this any time soon, so we're stuck installing the specific version :)

Extending upon the already accepted answer
If you are facing compilation errors like I did most probably you are using some application like MAMP.
Unfortunately the latest version of MAMP doesn't include all the components of php.
To install the missing headers download the respective php source code. Source code for php-5.6.10 can be downloaded from here

After downloading the source code extract it in the php folder under include/php in my case the php folder was located at /Applications/MAMP/bin/php/php5.6.10 so I extracted files under /Applications/MAMP/bin/php/php5.6.10/include/php .

Note: When you extract the files they are extracted in a folder like php-version in my case it was php-5.6.10 rename it to php and then move it to include folder.

Now go to /Applications/MAMP/bin/php/php5.6.10/include/php and then run ./configure this should build the required header files and then you can install oauth .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM