• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

phar: command not found

by Deepika

The phar (PHP Archive) is a format used for distributing and packaging PHP applications. A phar file is a single archive that contains all of the necessary components of a PHP application, including the PHP code, resources, and dependencies.

The phar extension in PHP provides the ability to create, update, and extract phar archives. Using the phar extension, you can package a PHP application into a single file that can be easily distributed and executed.

If you encounter the below error while running the command phar:

phar: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install php
Ubuntu apt-get install php
Alpine apk add php
Arch Linux pacman -S php
Kali Linux apt-get install php
CentOS yum install
php-cli
Fedora dnf install php-cli
OS X brew install php
Raspbian apt-get install php

phar Command Examples

1. Add space-separated files or directories to a Phar file:

# phar add -f path/to/phar_file files_or_directories

2. Display the contents of a Phar file:

# phar list -f path/to/phar_file

3. Delete the specified file or directory from a Phar file:

# phar delete -f path/to/phar_file -e file_or_directory

4. Display full usage information and available hashing/compression algorithms:

# phar help

5. Compress or uncompress files and directories in a Phar file:

# phar compress -f path/to/phar_file -c algorithm

6. Get information about a Phar file:

# phar info -f path/to/phar_file

7. Sign a Phar file with a specific hash algorithm:

# phar sign -f path/to/phar_file -h algorithm

8. Sign a Phar file with an OpenSSL private key:

# phar sign -f path/to/phar_file -h openssl -y path/to/private_key

Filed Under: Linux

Some more articles you might also be interested in …

  1. chgrp: command not found
  2. dolt checkout: Checkout the work tree or tables to a specific branch or commit
  3. ethtool Command Examples in Linux
  4. pvcreate Command Examples in Linux
  5. localectl: command not found
  6. What are Shell Scripts? How to Create Shell Scripts?
  7. meteor Command Examples
  8. How to find and delete files older than some particular time period in Linux
  9. csplit Command Examples in Linux
  10. csvcut: Filter and truncate CSV files

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright