How to install apfd PHP extension on Debian

Viewed 622

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.

1 Answers

Thanks to @Zeitounator I manage to install extension.

STEPS:

  1. 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
  1. Install localy community.general to use community.general.pear Ansible module:
ansible-galaxy collection install community.general 
  1. 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