<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/install.unix.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'install.unix.openbsd.php',
    1 => 'Installing from packages or ports on OpenBSD',
    2 => 'Installing from packages or ports on OpenBSD',
  ),
  'up' => 
  array (
    0 => 'install.unix.php',
    1 => 'Installation on Unix systems',
  ),
  'prev' => 
  array (
    0 => 'install.unix.dnf.php',
    1 => 'Installing from packages on GNU/Linux distributions that use DNF',
  ),
  'next' => 
  array (
    0 => 'install.unix.source.php',
    1 => 'Installing from source on Unix and macOS systems',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'install/unix/openbsd.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="install.unix.openbsd" class="sect1">
 <h2 class="title">Installing from packages or ports on OpenBSD</h2>
 <p class="para">
 This section contains notes and hints specific to installing
 PHP on <a href="http://www.openbsd.org/" class="link external">&raquo;&nbsp;OpenBSD</a>.
 </p>
 <div class="sect2" id="install.unix.openbsd.packages">
  <h3 class="title">Using Binary Packages</h3>
   <p class="simpara">
    Using binary packages to install PHP on OpenBSD is the recommended
    and simplest method.  The core package has been separated from the various
    modules, and each can be installed and removed independently from the others.
    The files you need can be found on your OpenBSD CD or on the FTP site.
   </p>
   <p class="simpara">
    The main package you need to install is <var class="filename">php</var>,
    which contains the basic engine (plus fpm, gettext and iconv) and might be
    available in several versions to choose from.  Next, take a look
    at the module packages, such as <var class="filename">php-mysqli</var>
    or <var class="filename">php-imap</var>.  You need to use the <strong class="command">phpxs</strong>
    command to activate and deactivate these modules in your <var class="filename">php.ini</var>.
   </p>
   <div class="example" id="install.unix.openbsd.ports.example">
    <p><strong>Example #1 OpenBSD Package Install Example</strong></p>
    <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># pkg_add php
# pkg_add php-apache
# pkg_add php-mysqli
  (install the PEAR libraries)
# pkg_add pear

Follow the instructions shown with each package!

  (to remove packages)
# pkg_delete php
# pkg_delete php-apache
# pkg_delete php-mysqli
# pkg_delete pear</pre>
</div>
    </div>

   </div>
   <p class="simpara">
   Read the <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=packages" class="link external">&raquo;&nbsp;packages(7)</a>
   manual page for more information about binary packages on OpenBSD.
   </p>
 </div>
 <div class="sect2" id="install.unix.openbsd.ports">
  <h3 class="title">Using Ports</h3>
  <p class="simpara">
   You can also compile up PHP from source using the <a href="http://www.openbsd.org/faq/ports/ports.html" class="link external">&raquo;&nbsp;ports tree</a>.
   However, this is only recommended for users familiar with OpenBSD.  The PHP port
   is split into core and extensions.  The
   extensions generate sub-packages for all of the supported
   PHP modules.  If you find you do not want to create some of these modules,
   use the <strong class="command">no_*</strong> FLAVOR.  For example, to skip building
   the imap module, set the FLAVOR to <strong class="command">no_imap</strong>.
  </p>
 </div>
 <div class="sect2" id="install.unix.openbsd.faq">
  <h3 class="title">Common Problems</h3>
  <ul class="itemizedlist">
   <li class="listitem">
     <span class="simpara">Apache and Nginx are no longer the default server on OpenBSD, but they can both be easily
      found in ports and packages. The new default server is also called &#039;httpd&#039;.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">The default install of httpd runs inside a
    <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=chroot" class="link external">&raquo;&nbsp;chroot(2) jail</a>, which will restrict PHP scripts to
    accessing files under <var class="filename">/var/www</var>.  You will therefore need to create a
    <var class="filename">/var/www/tmp</var> directory for PHP session files to be stored, or use an
    alternative session backend.  In addition, database sockets need to be placed inside the
    jail or listen on the <var class="filename">localhost</var> interface.  If you use network functions,
    some files from <var class="filename">/etc</var> such as <var class="filename">/etc/resolv.conf</var> and
    <var class="filename">/etc/services</var> will need to be moved into <var class="filename">/var/www/etc</var>.
    The OpenBSD PEAR package automatically installs into the correct chroot directories.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     The OpenBSD package for the <a href="http://www.libgd.org/" class="link external">&raquo;&nbsp;gd</a> extension
     requires Xorg to be installed. Unless already installed at base install by
     adding the <var class="filename">xbase.tgz</var> file set, this can be added at
     post-installation (see
     <a href="https://www.openbsd.org/faq/faq4.html#FilesNeeded" class="link external">&raquo;&nbsp;OpenBSD FAQ#4</a>).
    </span>
   </li>
  </ul>
 </div>
</div><?php manual_footer($setup); ?>