dh_php command not found

In this troubleshooting guide we learn how to fix dh_php command not found error message

Introduction

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

dh_php: command not found

or when using sudo you get the following error message

sudo: dh_php: command not found

Solutions to dh_php: command not found

How To Fix dh_php: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu dh_php is provided by dh-php package.

dh-php is:

dh-php provides a debhelper sequence add-on named ‘php’ and the dh_php command.

The dh_php command adds the appropriate code to the postinst, prerm and postrm maint scripts to properly enable/disable PHP PECL extensions for all available PHP SAPIs.

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

sudo apt-get -y install dh-php

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

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

sudo apt -y install dh-php

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

sudo aptitude install dh-php

Summary

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