phar.phar.default command not found

In this troubleshooting guide we learn how to fix phar.phar.default command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

phar.phar.default: command not found

or when using sudo you get the following error message

sudo: phar.phar.default: command not found

Solutions to phar.phar.default: command not found

How To Fix phar.phar.default: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu phar.phar.default is provided by php-cli package.

php-cli is:

This package provides the /usr/bin/php command interpreter, useful for testing PHP scripts from a shell or performing general shell scripting tasks.

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

This package is a dependency package, which depends on latest stable PHP version (currently 8.1).

To fix this problem, we can install more using the command below.

sudo apt-get -y install php-cli

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install php-cli.

sudo apt -y install php-cli

Or if you have aptitude installed you can use the following command.

sudo aptitude install php-cli

Summary

In this tutorial we learn how to fix phar.phar.default command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.