6.10 Using Apache and PHP

6.10.1 Apache

Table 6-10. Variables for ports that use Apache

USE_APACHE The port requires Apache. Possible values: yes (gets any version), 1.3, 2.0, 2.2, 2.0+, etc. Default dependency is on version 1.3.
WITH_APACHE2 The port requires Apache 2.0. Without this variable, the port will depend on Apache 1.3. This variable is deprecated and should not be used anymore.
APXS Full path to the apxs binary. Can be overriden in your port.
HTTPD Full path to the httpd binary. Can be overriden in your port.
APACHE_VERSION The version of present Apache installation (read-only variable). This variable is only available after inclusion of bsd.port.pre.mk. Possible values: 13, 20, 22.
APACHEMODDIR Directory for Apache modules. This variable is automatically expanded in pkg-plist.
APACHEINCLUDEDIR Directory for Apache headers. This variable is automatically expanded in pkg-plist.
APACHEETCDIR Directory for Apache configuration files. This variable is automatically expanded in pkg-plist.

Table 6-11. Useful variables for porting Apache modules

MODULENAME Name of the module. Default value is PORTNAME. Example: mod_hello
SHORTMODNAME Short name of the module. Automatically derived from MODULENAME, but can be overriden. Example: hello
AP_FAST_BUILD Use apxs to compile and install the module.
AP_GENPLIST Also automatically creates a pkg-plist.
AP_INC Adds a directory to a header search path during compilation.
AP_LIB Adds a directory to a library search path during compilation.
AP_EXTRAS Additional flags to pass to apxs.

Web applications should be installed into PREFIX/www/appname and should not assume Apache is present, unless they depend on Apache explicitly. User may wish to run them on different web server than Apache.

6.10.2 PHP

Table 6-12. Variables for ports that use PHP

USE_PHP The port requires PHP. The value yes adds a dependency on PHP. The list of required PHP extensions can be specified instead. Example: pcre xml gettext
DEFAULT_PHP_VER Selects which major version of PHP will be installed as a dependency when no PHP is installed yet. Default is 4. Possible values: 4, 5
BROKEN_WITH_PHP The port does not work with PHP of the given version. Possible values: 4, 5
USE_PHPIZE The port will be built as a PHP extension.
USE_PHPEXT The port will be treated as a PHP extension, including installation and registration in the extension registry.
USE_PHP_BUILD Set PHP as a build dependency.
WANT_PHP_CLI Want the CLI (command line) version of PHP.
WANT_PHP_CGI Want the CGI version of PHP.
WANT_PHP_MOD Want the Apache module version of PHP.
WANT_PHP_SCR Want the CLI or the CGI version of PHP.
WANT_PHP_WEB Want the Apache module or the CGI version of PHP.
WANT_PHP_PEAR Want the PEAR framework.

6.10.3 PEAR modules

Porting PEAR modules is a very simple process.

Use the variables FILES, TESTS, DATA, SQLS, SCRIPTFILES, DOCS and EXAMPLES to list the files you want to install. All listed files will be automatically installed into the appropriate locations and added to pkg-plist.

Include ${PORTSDIR}/devel/pear-PEAR/Makefile.common on the last line of the Makefile.

Example 6-2. Example Makefile for PEAR class

PORTNAME=       Date
PORTVERSION=    1.4.3
CATEGORIES=     devel www pear

MAINTAINER=     [email protected]
COMMENT=        PEAR Date and Time Zone Classes

BUILD_DEPENDS=  ${PEARDIR}/PEAR.php:${PORTSDIR}/devel/pear-PEAR
RUN_DEPENDS=    ${BUILD_DEPENDS}

FILES=          Date.php Date/Calc.php Date/Human.php Date/Span.php     \
                Date/TimeZone.php
TESTS=          test_calc.php test_date_methods_span.php testunit.php   \
                testunit_date.php testunit_date_span.php wknotest.txt   \
                bug674.php bug727_1.php bug727_2.php bug727_3.php       \
                bug727_4.php bug967.php weeksinmonth_4_monday.txt       \
                weeksinmonth_4_sunday.txt weeksinmonth_rdm_monday.txt   \
                weeksinmonth_rdm_sunday.txt
DOCS=           TODO
_DOCSDIR=       .

.include <bsd.port.pre.mk>
.include "${PORTSDIR}/devel/pear-PEAR/Makefile.common"
.include <bsd.port.post.mk>
For questions about the FreeBSD ports system, e-mail <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.