• 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 Examples in Linux

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.

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. Where to find ASMLib / oracleasm RPMs for CentOS/RHEL, SUSE, OEL
  2. How to Copy / Move Files and Directories in Linux with “cp” and “mv” commands
  3. cloud-init Command Examples in Linux
  4. How to determine file and free space fragmentation of OCFS2
  5. idle3: command not found
  6. nohup: command not found
  7. dpkg-deb: command not found
  8. avahi-browse Command Examples in Linux
  9. How To Store iptables Rules To Survive Across Reboots in CentOS/RHEL
  10. How to Install and Configure Device Mapper Multipath in CentOS/RHEL 6,7

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