DH_PHP(1)

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) 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) addon. In the former case the helper should run after dh_install(1) 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_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) 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), dh(1)

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