0

I was trying to install composer from the official docs when this popped up:

Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The phar extension is missing.
Install it or recompile php without --disable-phar

The iconv OR mbstring extension is required and both are missing.
Install either of them or recompile php without --disable-iconv

I tried installing php-phar and php8.1-phar using apt-get but it seems to have been replaced by php8.1-common.

lvjhn@peridot:~/Temp$ sudo apt install php8.1-phar
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php8.1-common' instead of 'php8.1-phar'
php8.1-common is already the newest version (8.1.11-1+ubuntu22.04.1+deb.sury.org+2).

Edit: I used the wrong word search instead of install.

I'm using the one from ondrej repository.

How to solve? Thank you.

LJ S.A.
  • 23
  • 4
  • 1
    Does this answer your question? [How do I install / enable the PHP phar extension?](https://stackoverflow.com/questions/22047487/how-do-i-install-enable-the-php-phar-extension) – Justinas Oct 04 '22 at 07:36
  • _phar_, _iconv_ and _mbstring_ are PHP extensions, not Composer packages, that's why you don't find them – Justinas Oct 04 '22 at 07:36
  • Sorry, I used the wrong word search instead of install. I edited the question to show what happens when installing. The extension php8.1-common seems to be picked instead of php8.1-phar. Is this normal when installing php8.1? – LJ S.A. Oct 04 '22 at 07:48
  • I solved my problem by following this tutorial from DigitalOcean. The instructions are slightly different from the official docs but it works. The [Digital Ocean Solution](https://www.digitalocean.com/community/tutorials/how-to-install-php-8-1-and-set-up-a-local-development-environment-on-ubuntu-22-04). [Installing composer](https://i.stack.imgur.com/jaQul.png) [Handling corruption](https://i.stack.imgur.com/9b0EP.png) – LJ S.A. Oct 04 '22 at 07:58

0 Answers0