php-cgi.default command not found

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

Introduction

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

php-cgi.default: command not found

or when using sudo you get the following error message

sudo: php-cgi.default: command not found

Solutions to php-cgi.default: command not found

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

In Ubuntu php-cgi.default is provided by php-cgi package.

php-cgi is:

This package provides the /usr/lib/cgi-bin/php CGI interpreter built for use in Apache 2 with mod_actions, or any other CGI httpd that supports a similar mechanism. Note that MOST users probably want the php-fpm package that provide FastCGI support.

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-cgi

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

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

sudo apt -y install php-cgi

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

sudo aptitude install php-cgi

Summary

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