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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. genfstab: command not found
  2. How to make alias command work in bash script or bashrc file
  3. date: command not found
  4. How to Mirror Swap, Boot and Root Partions in CentOS/RHEL 7 Using mdadm Utility
  5. engrampa: command not found
  6. setsebool Command in Linux
  7. nc: command not found
  8. Command ‘df -i’ Shows ‘Inode=0’ on BTRFS File System
  9. What are Bash Exit Codes in Linux
  10. mumble Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright