---
name: "dh_php"
section: "1"
platform: "linux"
package: "dh-php"
version: "5.10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/dh_php"
---

# dh\_php(1)

register configuration snippets to the PHP

## NAME

dh\_php - register configuration snippets to the PHP

## SYNOPSIS

**dh\_php** \[*debhelper options*\] \[**--conditional**=*expression*\] \[**--error-handler=***function*\] \[**-n**\|**--noscripts**\] \[**--php-version=***php\_version*\]

## DESCRIPTION

**dh\_php** is a debhelper program that is responsible for correctly installing PHP configuration snippets and setting postinst, prerm and dependencies in PHP web server modules and web applications.

It supports the following configuration types

- •

  PHP modules

**dh\_php** supports only a configuration file driven approach. If a file named debian/*package*.php exists, actual actions are determined by that file.

## OPERATION MODES

**dh\_php** can only be used in a configuration file driven approach. The configuration driven mode is fully documented in the **FILES** section below.  This mode is activated by supplying a [**debhelper**(7)](/debhelper/7.md) configuration file (e.g. debian/*package*.php).

## INVOCATION

**dh\_php** is not part of debhelper and might require information available in the php-all-dev package.  Packages making use of **dh\_php** should declare a build-dependency against the virtual **dh-php** package.

**dh\_php** supports both, called directly from a debian/rules file or as [**dh**(1)](/dh/1.md) addon.  In the former case the helper should run after [**dh\_install**(1)](/dh_install/1.md) or their respective counter parts in local implementations at earliest.  Alternatively it can be used as dh addon by invoking it with

```
  %:
     dh $@ --with php
```

## FILES

- debian/*package*.php

  - debian/php

  Lists files to be registered with the PHP. The file is interpreted as line separated list of installation stanzas, where each entry consists of whitespace separated values conforming to the file semantics below.

### FILE SEMANTICS

Each line consists of a triple

*type* *file* \[*arguments*\]

where the values are interpreted as follows:

*type*

Denotes the type of file to be installed. Recognized values are **mod** for PHP modules.

*file*

Is interpreted as existing file name within the source package. No path expansion is effectuated.  Just like [**dh\_install**(1)](/dh_install/1.md), **dh\_php** can not rename files.

### MODULES

Modules are handled specially and are determined by the **mod** type. Modules can have a *.ini* suffix.  In that case the file is interpreted as a module configuration file respectively and is installed to */etc/php/\<VERSION(s)*/mods-available\>.  If the file is ending with a *.so* suffix it is interpreted as actual module shared object and is installed to the PHP module directory.  Moreover, if a *.ini* file is installed the configuration is activated in the maintainer script at installation time.

A typical module configuration has two lines, one for the *.ini* file, and one for the *.so* file, albeit the latter could be installed by upstream's makefile, too.

**dh\_php** will set dependencies in **${php:Depends}** accordingly when this type of configuration is found.

## OPTIONS

- **--php-version=***php\_version*

  Make all calls to PHP versioned with \<php\_version\>, e.g. php-config becomes php-config\<php\_version\>.

- **--error-handler=***function*

  Call the named shell *function* if running the maintainer script fails.  The function should be provided in the *prerm* and *postinst* scripts, before the **#DEBHELPER#** token.

- **-e**, **--noenable**

  Install maintainer scripts accordingly, but do not enable the scripts or configuration by default.

- **-n**, **--noscripts**

  Do not modify *preinst*/*postinst*/*postrm*/*prerm* maintainer scripts.

## NOTES

Note that this command is not idempotent.  [**dh\_prep**(1)](/dh_prep/1.md) should be called between invocations of this command.  Otherwise, it may cause multiple instances of the same text to be added to maintainer scripts.

## EXAMPLES

The examples below lists valid entries for a debian/*package*.php file.  For example, the two lines below install a fictional *foo* PHP module along a Debian specific *.ini* file:

```
 mod src/foo/foo.so
 mod debian/foo.ini
```

## SEE ALSO

phpquery(8), [debhelper(7)](/debhelper/7.md), [dh(1)](/dh/1.md)

## AUTHOR

This manual and dh\_php was written by Arno Toell \<debian@toell.net\> for Apache 2 and modified for PHP by Ondrej Sury \<ondrej@sury.org\>.
