Installing OAuth PECL package on PHP 5 on OS X - php

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.

Related

Install PHP Extension xml

I installed phpmyadmin but when I go to myIP/phpmyadmin, I get this error:
Composer detected issues in your platform: Your Composer dependencies require the following PHP extensions to be installed: xml
I have tried to reinstall it but nothing changed
Maybe still important when I reinstall it, I get this output:
php8.0-xml is already the newest version (8.0.12-1+0~20211022.25+debian10~1.gbp06192c).
Have you do check your PHP version with phpinfo();?
Maybe you have more than one PHP version installed on your system and you are installing the XML in a different PHP installation.

Install PHP 7.0 Internationalization extension (Intl) on XAMPP on Mac

I followed the instructions outlined here:
Install PHP Internationalization extension (Intl) on XAMPP on Mac
Ran sudo pecl install intl
selected the correct files from the Cellar
then this error happened:
/private/tmp/pear/temp/intl/intl_error.h:24:10: fatal error:
'ext/standard/php_smart_str.h' file not found
include
^ 1 error generated. make: *** [php_intl.lo] Error 1 ERROR: `make' failed
No matter, did some research and found out that PHP 7.0.8 deprecated php.smart_str.h to php.smart_string.h
So given my scant knowledge of C++ I copied smart_string.h to smart_str.h and renamed all the headers from STRING to string.....
re-ran pecl -no luck....more errors......without knowing where the .c files are and remaking php (not really interested in going that far) since anyway I'm using XAMPP so that ended that option.
I have php 5.5 on my mac, deep in the usr/local/bin folder
so next step was to get pecl to use those files and generate an intl.so file....
Did that....I have the intl.so file so put it in the 'extensions' folder in XAMPP (for reference: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012)
Ran php and came up with this error:
Warning: PHP Startup: Unable to load dynamic library
'/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so'
- dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so,
9): Symbol not found: _zval_used_for_init Referenced from:
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
Expected in: flat namespace in
/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so
in Unknown on line 0
I imagine it has to do with different versions?
In any case I can't get pecl to install intl without a make error in PHP 7.0.8 on XAMPP. There is no documentation on this and you'd think that if you deprecate a header.h file you'd update all extensions?
Install intl.so in PHP 7 seems impossible?
After a lot of research I was finally able to resolve this. Detailed steps here:
before you begin, check which php path is set. it should be /Applications/XAMPP/xamppfiles/bin/php. If not you can change it by PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}". more detail here
Overall idea is to build the intl-extension from PHP source code on your own. Before you begin make sure you have installed Xcode. Also, install the latest version of autoconf. this might help:
brew install autoconf
Next download the version of PHP you use in XAMPP from php.net. I am using 7.1.18. This version worked for me: php-7.1.31, I’m guessing if you follow the steps it might work for 7.0 or 7.2 as well. Do let me know if it does or doesnt, I’ll update this post. Do not use PHP 7.3 for Magento 2.3.0, it is not supported.
Extract the tar.gz file using (I extracted it inside ~/Downloads/ folder )
tar -xzvf php-7.1.31.tar.gz
cd into the extracted folder
cd php-7.1.31
change to subfolder ext/intl
cd ext/intl/
Run these commands to build the extension
/Applications/XAMPP/bin/phpize
./configure --enable-intl --with-php-config=/Applications/XAMPP/bin/php-config --with-icu-dir=/Applications/XAMPP/xamppfiles/
make
sudo make install
you can now delete all files you downloaded and also the extracted folders.
Open /Applications/XAMPP/xamppfiles/etc/php.ini , and add extension=intl.so
Restart your Apache using XAMPP GUI and it should work.
So far, it seems that extension intl.so for php is bundled with php
and should be compiled with php (intl --enabled). XAMPP does not support this (as of Oct 2016), MAMP does. I do not know about other distros. However, if you're willing to recompile PHP 7, it's worth it just to do that and enable it during compiling.
So....I ran with MAMP. Then I decided that I would simply install apache 2.4 and php 7 and Mysql without the stack and the junk that comes with MAMP or XAMPP and everything works like a charm... so if you need to use CakePHP or intl support etc... just drop XAMPP/MAMP and go with a standard install. I used homebrew (MacOS) and everything is working fine.
Update: As regards Windows, XAMPP does not default it, but you can add the module (dll) in php.ini and works like a charm
The error means that XAMPP doesn't have PHP compiled with intl. You may try:
pecl install intl
but probably it won't work as well.
See: PHP Bug #72879 Pecl install intl make error with PHP 7.0.8.
As for the workaround, try installing memcached extension instead of memcache, e.g.
pecl install memcached
Note: It also requires libmemcached package/library to be installed beforehand. For macOS, install via: brew install libmemcached.
If you wanna try without homebrew, with native apache and php, look at my aswer here: https://stackoverflow.com/a/55131868/3692846

PHP pecl inclued: How to compile and install very latest version

The installible versions of the pecl extension 'inclued' apparently are incompatible with the latest versions of PHP (I'm using 5.5.9). A bug report has been filed and a fix with updated sources noted. Through svn, I have downloaded the updated files. How do I compile the very latest sources and install them?
This is on a standard EC2 ubuntu instance.
A little bit more googling found the following:
http://php.net/manual/en/install.pecl.phpize.php
Gives fairly straightforward directions on compiling and installing a pecl extenstion.
The makefile name wasn't quite the same and had to use 'php -i' to find the extension directory. Also, restarted apache. But seems to be installed.

How do I solve this PHP-PEAR error / install PEAR on Fedora?

I'm trying to save an old, failing web-server setup consisting of Fedora, PHP, PEAR, and Oracle.
With some difficulty (I'm very new to all four), I've been able to set up something similar on a newer system. I used Fedora 19, PHP 5.5.4 (with Apache 2.4.6), and Oracle 11g.
That just leaves PEAR.
Now, from what I understand, PEAR is some PHP code, like a library, which PHP Web Applications can use to save time from having to code them again - database connection, for example.
But I don't know what to do with it, or even how to get it. Copy paste from my old system? Download using the CLI using yum? Are there packages I need to be aware of, or is it just a one download-one install thing?
For instance, a basic PHP webpage with the following code:
<?php
phpinfo();
?>
works fine on the new server setup, so I'm assured that everything else is working. But when I try to load the PHP files from the other server, it returns an Internal Server Error. I checked the error_log files under /etc/httpd/logs, and most of the errors appear as below:
PHP Fatal error: require_once(): Failed opening required 'MDB2.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/hrweb/includes/functions.php on line 4
EDIT:
According to the PEAR Website, PEAR is included upon the installation of PHP, though not all modules / packages are there. Typing in the command pear in the CLI does confirm it is installed, though it does not help the issue.
I got the MDB2 package via pear install MDB2, though apparently, MDB2_Driver_oci8 is required. Whenever I try to download that, I get the following:
"MDB2_Driver_oci8" version "1.4.1" does not have REST XML available
In addition to this, I also tried to download OLE, which gets me the following:
No releases available for package "pear.php.net/OLE"
This was also previously the error of trying to download MDB2_Driver_oci8.
Thanks.
You have to install the (surprise!) MDB2 package to get MDB2.php:
$ pear install mdb2
and the adapter of your choice:
$ pear install mdb2_driver_mysql-beta
Then make sure the PEAR php directory is in your include path - see the PEAR manual.
"MDB2_Driver_oci8" version "1.4.1" does not have REST XML available
try to install the beta version:
$ pear install mdb2_driver_oci8-beta
No releases available for package "pear.php.net/OLE"
You're trying to install the stable version, but OLE does not have any stable version (yet): http://pear.php.net/package/OLE/download
Append either -alpha or -beta after OLE:
$ pear install OLE-beta

All-in-one PHP bundle for Ubuntu

I need to deploy Zend Framework app on Ubuntu.
I've downloaded Ubuntu desktop, installed using apt-get apache+php+mysql,
but PHP turned out to be not the latest 5.3, but 5.2.1 and even
mysql extension is missing.
I understand I can get somewhere a fresh php installation, get dependent libs (like curl or libxml2) compile them one by one and then I get full-features latest PHP bundle.
But is there anywhere already full PHP bundle with latest version and all libs to get
ZF app running very quickly?
One of the downsides of package management is that you're at the mercy of the package maintainers. Ubuntu has opted not to update to PHP 5.3 in this version, so you'll have to either wait until 2010 for it or compile PHP yourself.
Most of the PHP extensions that arent in a default source build directly from PHP are in seperate apt packages. If you do a search for PHP5 in you package manager youll see packages like:
PHP5
PHP5-Mysql
PHP5-cli
PHP5-SQLite
etc..
Im going to assume that there are also packages specifically for php 5.3 - most likely labeled as php53-* or something similar. You may need to adda repo for this as im not sure its in the crore repos.
Anyhow you need to isntall all these packages that you need to use.
I ran into similar issues getting the latest PHP on my CentOS server. I installed Zend Server Community Edition, which sets up it's own Apache/PHP5.3 stack in /usr/local/zend. And here's a Getting Started article.
It's a full PHP bundle.
If you need other packages for Ubuntu, check the ubuntu repository for PHP5 at http://bg.archive.ubuntu.com/ubuntu/pool/main/p/php5/

Categories