The lang/php/7.3 port

php-7.3.22 – server-side HTML-embedded scripting language (cvsweb github)

Description

PHP is a popular general-purpose scripting language. It can be embedded
in HTML documents and is frequently used as a server-side language for
web development but can also be used for command-line scripts.

It is cross-platform and has various front-ends ("SAPIs") that can be
used in conjunction with many web servers.

This main package includes the most common SAPIs: cli (the stand-alone
binary which can be used for command-line scripts) and fpm (the "FastCGI
process manager" which manages a pool of separate processes that accept
web-server requests over the FastCGI protocol).

Other SAPIs are packaged separately: php-cgi ("old style" CGI binary),
php-dbg (debugger), php-apache (an Apache 2 module).

Many language extensions are available - the most common are included
directly in the main packages, but others (usually requiring additional
dependencies) are packaged separately, notably those adding database
connectivity.
WWW: https://www.php.net/

Readme

$OpenBSD: README-main,v 1.9 2019/01/29 20:25:15 sthen Exp $

+-----------------------------------------------------------------------
| Running ${PKGSTEM} on OpenBSD
+-----------------------------------------------------------------------

Connecting your web server software to php
==========================================
Web server programs such as httpd(8), nginx and Apache listen for
network requests and decide whether to respond themselves (as is the
case with simple "static" files) or pass the request on to other
software for handling. The web server must be configured to handle
this - different methods are used depending on the server software.

FastCGI: httpd(8), nginx, lighttpd, etc
---------------------------------------
Most modern web servers support FastCGI which is a simple method of
interfacing to many kinds of application server. This is usually the
preferred method of passing requests to php, and is the only method
possible for many servers such as httpd(8), nginx and lighttpd.

The main OpenBSD php packages include php-fpm, FastCGI Process Manager.
This manages pools of FastCGI processes: starts/restarts them and
maintains a minimum and maximum number of spare processes as
configured. You can use rcctl(8) to enable php-fpm at boot,
and start it at runtime:

    rcctl enable php${SV}_fpm
    rcctl start php${SV}_fpm

php-fpm has its own configuration file, ${SYSCONFDIR}/php-fpm.conf.
This controls how the php processes are started. The default settings
are suitable for many standard cases, but can be changed to provide
greater control for sites handling high loads or to provide
separation between different php applications by running them
under different uids or in individual chroot(2) jails.

Your HTTP server needs to be configured to pass requests for PHP
resources to php-fpm. See the documentation and sample configuration.
For nginx, an example is provided in ${LOCALBASE}/share/nginx/nginx.conf.
For OpenBSD base's httpd(8) you can use a configuration fragment like:

	location "*.php" {
		fastcgi socket "/run/php-fpm.sock"
	}

Apache httpd
------------
For Apache, the most common option is with the mod_php Apache module
provided in the php-apache package. This is loaded directly as part of
the web server process. Configuration is fairly simple, but in this
case the operating system can't provide memory protection between
the two; therefore bugs in php can potentially do more damage.

Another option is to use FastCGI via php-fpm as in the above section;
you can use mod_proxy_fcgi to interface it with Apache.

If you wish to use the Apache module, make sure the php-apache-${PV}
package is installed, then enable it by creating a symbolic link:

    # ln -sf ${MODPHP_CONFIG_PATH}/modules.sample/php-${PV}.conf \
	${MODPHP_CONFIG_PATH}/modules/php.conf

To disable:

    # rm -f ${MODPHP_CONFIG_PATH}/modules/php.conf

After making either of these changes, restart Apache.

php configuration
=================
The recommended php configuration has been installed to:
    ${SYSCONFDIR}/php-${PV}.ini.

Modify this as required for your use.

Extension modules
=================
Many language features in php are provided by extensions, which come
in several classes.

- some extensions are included in the main PHP package and are always
enabled; they don't need to be installed or enabled separately.

- opcache is in the main package but must be configured.

- some 'core' extensions with extra dependencies are packaged separately
(e.g. php-pdo_mysql, php-ldap, php-soap, and others) and can be installed
with pkg_add(1).

- various useful third-party extensions from the PECL repository have
also been packaged. Examples include pecl-memcache (for use with
sysutils/memcached), pecl-imagick (image manipulation using ImageMagick),
pecl-libsodium (a wrapper for the libsodium cryptographic library), etc.

For all extensions packaged separately (and for opcache), you will find a
file named ${SYSCONFDIR}/php-${PV}.sample/(MODULE_NAME).ini. To enable it,
add a symlink into ${SYSCONFDIR}/php-${PV} and restart:

    ln -sf ../php-${PV}.sample/MODULE_NAME.ini ${SYSCONFDIR}/php-${PV}/

To disable, remove the symlink from ${SYSCONFDIR}/php-${PV} and restart:

    rm ${SYSCONFDIR}/php-${PV}/MODULE_NAME.ini

If you have installed a number of extensions and wish to enable them all,
you can use these shell commands:

    # cd ${SYSCONFDIR}/php-${PV}.sample
    # for i in *; do ln -sf ../php-${PV}.sample/$i ../php-${PV}/; done

After enabling or disabling extensions (or otherwise modifying php's
configuration), use rcctl(8) to restart php${SV}_fpm or Apache.

PHP's OpenSSL functions
=======================
The chroot jail commonly used with PHP on OpenBSD means that only files
inside /var/www can be used. Functions for making TLS connections usually
need access to CA certificates, and key generation functions may need
access to configuration files.

To use these, copy the relevant files into the /var/www jail:

    # mkdir -p ${CHROOT_DIR}/etc/ssl
    # install -m 444 -o root -g bin /etc/ssl/cert.pem /etc/ssl/openssl.cnf \
          ${CHROOT_DIR}/etc/ssl/

As these files are updated from time to time, you might like to add
the above "install" line to /etc/rc.local.

Maintainer

Stuart Henderson

Multi-packages

php-7.3.22 php-apache-7.3.22 php-cgi-7.3.22 php-dbg-7.3.22 php-bz2-7.3.22 php-curl-7.3.22 php-dba-7.3.22 php-enchant-7.3.22 php-gd-7.3.22 php-gmp-7.3.22 php-intl-7.3.22 php-imap-7.3.22 php-ldap-7.3.22 php-mysqli-7.3.22 php-odbc-7.3.22 php-pcntl-7.3.22 php-pdo_mysql-7.3.22 php-pdo_odbc-7.3.22 php-pdo_pgsql-7.3.22 php-pdo_sqlite-7.3.22 php-pgsql-7.3.22 php-pspell-7.3.22 php-shmop-7.3.22 php-soap-7.3.22 php-snmp-7.3.22 php-sqlite3-7.3.22 php-pdo_dblib-7.3.22 php-tidy-7.3.22 php-xmlrpc-7.3.22 php-xsl-7.3.22 php-zip-7.3.22

Broken

on hppa: no __sync_bool_compare_and_swap support nor asm fallback

Categories

lang www

Library dependencies

Build dependencies

Run dependencies

Reverse dependencies

Search
File Descr
Path Name
Category Maintainer