How to install apfd PHP extension on Debian - php

I would like to install apfd PHP extension on Debian Buster, but looks like system can't find it.
Link to extension: https://pecl.php.net/package/apfd
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-14-cloud-amd64
PHP version:
$ php --version
PHP 7.3.27-9+0~20210223.81+debian10~1.gbpa4a3d6 (cli) (built: Feb 23 2021 16:47:00) ( NTS )
It's not avaliable in apt list as other php packages even after apt update:
$ sudo apt search apfd
Sorting... Done
Full Text Search... Done
texlive-fonts-recommended/stable 2018.20190227-2 all
TeX Live: Recommended fonts
This is what I was trying to do:
$ sudo apt install php7.3-apfd
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.3-apfd
E: Couldn't find any package by glob 'php7.3-apfd'
E: Couldn't find any package by regex 'php7.3-apfd'
As well as:
$ sudo apt install php7-apfd
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7-apfd
I already update apt, ondrej-php.
This is quite strange, because I always use this Ansible task for PHP packages installation and never had problems like that:
- name: Install additional PHP modules required by PHP Unit
apt: pkg=php7.3-{{ item }} state=present
loop: "{{ php_modules }}"
when: php_version != 5
notify: restart fpm
php_modules:
- xml
- mbstring
- curl
- bcmath
- bz2
- dba
- soap
- zip
- intl
- gd
- imagick
- apfd
When running this Ansible task with apfd this error occured:
"item": "apfd",
"msg": "No package matching 'php7.3-apfd' is available"
I don't have any idea how to fix it.
I can install other php packages like imagick, gd, intl or soap with success using mentioned Ansible tasks.

Thanks to #Zeitounator I manage to install extension.
STEPS:
Install php-pear and php{{ php_version }}-dev on server:
Command line version:
sudo apt install php-pear php7.3-dev
Ansible version:
- name: Install PHP packages
apt: pkg={{ item }} state=present
loop:
- php-pear
- php7.3-dev
Install localy community.general to use community.general.pear Ansible module:
ansible-galaxy collection install community.general
Install apfd extension via pecl:
Command line version:
pecl install apfd
Ansible version:
- name: Install pear package
community.general.pear:
name: pecl/apfd
state: present

Related

Ubuntu 20.04.2 PHP Error while pecl install

I'm trying to install sqlsrv driver.
root#testapp:/# pecl install sqlsrv
Notice: Trying to access array offset on value of type bool in PEAR/REST.php on line 187
PHP Notice: Trying to access array offset on value of type bool in /usr/share/php/PEAR/REST.php on line 187
pecl version information.
root#testapp:/# pecl version
PEAR Version: 1.10.9
PHP Version: 7.4.3
Zend Engine Version: 3.4.0
Running on: Linux test app 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64
If it says: "No releases available for package ...", you will need to install php-dev package to get the necessary PHP5 source files to compile additional modules.
Run apt-get install php-dev
You can specify specific version: apt-get install php8.0-dev
If you see "make: not found", you need to have make installed
Run sudo apt-get install build-essential
If you see: "WARNING: channel 'pecl.php.net' has updated its protocols":
Run pecl channel-update pecl.php.net
If you see: "Missing sql.h", you will need to install unixodbc-dev package.
Run apt-get install -y unixodbc-dev
I'm guessing you're missing the last package, which is necessary for pecl command to install the PHP drivers.
If it still does not work, please update the complete error message.
You can refer to:
Linux and macOS Installation Tutorial for the Microsoft Drivers for PHP for SQL Server
Channel "pecl.php.net" has updated its protocols
AskUbuntu: Install PECL Packages on Ubuntu

Can't install again php5.6-curl on ubuntu 16.10. ppa is added.

Im trying to install php5.6-curl package. It was installed before but I did some stuff with manual build of curl, so I had remove php5.6-curl package from system. I also ran apt autoremove after this operation.
So, after successfull build stuff I was trying to call apt-get install php5.6-curl and it showed me this.
dirst#dirst-machine:~$ sudo apt-get install php5.6-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5.6-curl is not available, but is referred to by another
package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php5.6-curl' has no installation candidate
You can be sure that ppa:ondrej/php5-5.6 is installed on my ubuntu as php5.6 is present in the system and php5.6-curl package had been isntalled before.
I also tried to add ppa again and ran apt-get update. Im not sure what this messages means.
http://ppa.launchpad.net/ondrej/php/ubuntu yakkety InRelease
.....
Fetched 107 kB in 3s (31.9 kB/s)
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/shutter/ppa/ubuntu yakkety Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: https://repo.skype.com/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 1F3045A5DF7587C3
W: The repository 'https://repo.skype.com/deb stable InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: https://linuxdesktopcloud.mail.ru/screenshoter/deb/dists/appind/InRelease: Signature by key 8A99BA500079839DF7DE4833196205AF7396FF77 uses weak digest algorithm (SHA1)
E: Failed to fetch http://ppa.launchpad.net/shutter/ppa/ubuntu/dists/yakkety/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Next what I tried is to check php extensions available with apt-cache search php5.6. There is no php5.6-curl but I know it should be there.
dirst#dirst-machine:~$ apt-cache search php5.6
php-igbinary - igbinary PHP serializer
php-msgpack - PHP extension for interfacing with MessagePack
php-ssh2 - Bindings for the libssh2 library
php-xdebug - Xdebug Module for PHP
php5.6-opcache - Zend OpCache module for PHP
php5.6-mysql - MySQL module for PHP
php5.6-json - JSON module for PHP
php5.6-common - documentation, examples and common module for PHP
php5.6 - server-side, HTML-embedded scripting language (metapackage)
php5.6-mcrypt - libmcrypt module for PHP
php5.6-readline - readline module for PHP
php5.6-gd - GD module for PHP
php5.6-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php5.6-cli - command-line interpreter for the PHP scripting language
php5.6-mbstring - MBSTRING module for PHP
php5.6-ldap - LDAP module for PHP
libapache2-mod-php5.6 - server-side, HTML-embedded scripting language (Apache 2 module)
php-memcached - memcached extension module for PHP, uses libmemcached
I also launched clean ubuntu 16.04 in the cloud and tried to do same actions.
- Install php5.6, php5.6-curl.
- Remove curl and then build it manually
- Install php5.6-curl again
All worked like a charm. And list of the extensions is way too bigger when I execute apt-cache search php5.6 on cloud ubuntu.
I dont't know what am I doing wrong, Im not really strong linux guys, so I have no Idea what is going on. Please help.
guys from askubuntu helped. Thing was obvious. Just change ppa repo to xenial from yakkety and it works. As yakkety doesn't have php5.6-curl in repo.

PHP | "The requested PHP extension bcmath is missing from your system."

Greetings fellow developers,
I am trying to use composer for a PHP project of mine on a development server I recently booted up and for some reason I am unable to. I successfully installed composer, however, when I try to run the require command I get the following error:
root#webserver:/var/mypersonal/index# composer require php-amqplib/php-amqplib
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_openssl.dll' - /usr/lib/php/20151012/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^2.6 for php-amqplib/php-amqplib
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- php-amqplib/php-amqplib v2.6.3 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
- php-amqplib/php-amqplib v2.6.2 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
- php-amqplib/php-amqplib v2.6.1 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
- php-amqplib/php-amqplib v2.6.0 requires ext-bcmath * -> the requested PHP extension bcmath is missing from your system.
- Installation request for php-amqplib/php-amqplib ^2.6 -> satisfiable by php-amqplib/php-amqplib[v2.6.0, v2.6.1, v2.6.2, v2.6.3].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, deleting ./composer.json.
I'm assuming it's something to do with the PHP warning I recieve right when running the composer require command but no google search results lead me to the correct direction.
Additionally, I have provided my /etc/php/7.0/cli/php.ini file incase of an error in that file.
https://gist.github.com/anonymous/bc5bac59d684cbf575cef931ef36daf6 (I couldn't include the file in this post due to the character limit on posts.)
Thank you.
You can use function get_loaded_extensions to see if bcmath modul is loaded. Or in terminal php -m or php -m | grep name_of_the_modul
You can install it depending on what OS you are using:
Ubuntu
sudo apt install php7.0-bcmath
CentOS
yum install bcmath
PHP 7.2
Debian - jessie
apt-get update
apt-get install php7.2-bcmath
work like a charm :)
For any version in php Centos use
This solution worked for me
yum install php-bcmath
PHP will take the default version installed in the machine, search for that package and install it.
Delete the file composer.lock file if that is already created and then run again,
composer install
If you run
composer update
it will update whatever default packages are installed in composer.json which might create problem for you.
In Ubuntu 20.04
For php 7.4.3, sudo apt install php7.4-bcmath
For PHP 7.1, the following worked for me:
sudo apt install php7.1-bcmath
If you are using Docker:
bcmath can be installed by running this command inside a container: docker-php-ext-install bcmath
check your php version by type: php --version
you will see something like this:
PHP 7.2.9-1+ubuntu16.04.1 ....
then sudo apt install phpX.X-bcmath where X.X is php version, so for this ^ example it will be sudo apt install php7.2-bcmath
after this check if module existed or not by type php -m | grep bcmath
php 7.2 if you have other version just change it accordingly
For CentOS
sudo yum install php72-bcmath
For Ubuntu
sudo apt install php7.0-bcmath
Run this command, hope it will works
sudo apt-get install php-bcmath
hope this will fix the problem.
sudo apt install php-bcmath
For this problem we should use sudo apt install php-bcmath
Strange thing here
Some month ago I have installed all PHP version in the same manner. In here are the 4 identically configured version of php: 5.6, 7.0, 7.1, 7.2, with the same extensions ( when this was made possible ).
The strange thing was that bcmath is present for all php version excluding 7.1.
In the solution search I arrive here in this question, where the logic's things was confirmed installing bcmath, but in my Linode Debian 9 server the command
apt install php7.1-bcmath
doesn't work, with 3 error messages;
E: Impossible to find the package php7.1-bcmath
E: Impossible to find some package with glob "php7.1-bcmath"
E: Impossible to find a package with the regular expression "php7.1-bcmath"
The goals no meet with any combination of tips and trick, refreshing apt cache, change Debian's mirrored server, installing yum, so on...
After some tentatives I had an illumination: modificating of /etc/apt/sources.list enabling the default Linode repository, then after an apt update (with no solution in the immediate), I have restored the /etc/apt/sources.list commenting out the Linode mirror sources again. Magically, after the new apt update the command now are working.
By this I confirm: apt install php7.1-bcmath is the right command, but your Debian can need a kick in the ass
Install with this command, thats work for me
apt-get install php-bcmath
I tried below package and it worked in Php version 5.6
yum install php56w-bcmath
For those who have already tried installing bc-math and still composer is giving errors.
Try this command
rm composer.lock
It will definitely work

unableto install php7 on ubuntu

I want to install php7 or 7.1 in Ubuntu but i can't
I try with this code :
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1
and this is result :
sudo: unable to resolve host myvps
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.1
E: Couldn't find any package by regex 'php7.1'
Also for PHP 7.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0
E: Couldn't find any package by regex 'php7.0'
But i know i can install php5 but i don't want !
se result of this commend php -v
root#myvps:~# php -v
The program 'php' is currently not installed. You can install it by typing:
apt-get install php5-cli
and here is my ubuntu information :
root#myvps:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid
whats wrong ? is it possible to solve this problem ?
All code is correct however we need to attention to Kernel release end of life it is so important !
My problem is from here !
and for solve that we have 2 option :
first upgrade Kernel release (recommended)
second use from this hack (at your own risk)
Try without adding any repositories.
sudo apt-get install php7.0

Unable to install php solr extension

Using pecl install -n solr gives
No releases available for package "pecl.php.net/solr"
install failed
Also tried pear install pecl/solr which gives the same output :
No releases available for package "pecl.php.net/solr"
install failed
I'm using a Mac and php56.
Output of pecl -V
PEAR Version: 1.9.4
PHP Version: 5.6.25
Zend Engine Version: 2.6.0
Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016;
root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
Another important piece of information is that, pear and pecl were not available in my system, so I installed them using
sudo php /usr/lib/php/install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin
Update
Tried sudo pecl install -n solr and now it seems to go one step further
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: phpize failed
Luckily stumbled upon
PEAR package install fails
which led to execute
pear list-upgrades which showed some kind of permission issue with cache directory, manually created the directory using sudo at the specified location (/private/tmp/pear/cache)
And then used sudo to install the solr extension as sudo pecl install -n solr which threw the following error :
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
brew install autoconf followed by sudo pecl install solr worked.

Categories