Source of: /manual/en/install.unix.openbsd.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = 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 => 'OpenBSD installation notes',
),
'up' =>
array (
0 => 'install.unix.php',
1 => 'Installation on Unix systems',
),
'prev' =>
array (
0 => 'install.unix.hpux.php',
1 => 'HP-UX specific installation notes',
),
'next' =>
array (
0 => 'install.unix.solaris.php',
1 => 'Solaris specific installation tips',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="install.unix.openbsd" class="sect1">
<h2 class="title">OpenBSD installation notes</h2>
<p class="para">
This section contains notes and hints specific to installing
PHP on <a href="http://www.openbsd.org/" class="link external">» OpenBSD 3.6</a>.
</p>
<div id="install.unix.openbsd.packages" class="sect2">
<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">php4-core-4.3.8.tgz</var>,
which contains the basic engine (plus gettext and iconv). Next, take a look
at the module packages, such as <var class="filename">php4-mysql-4.3.8.tgz</var>
or <var class="filename">php4-imap-4.3.8.tgz</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">
<p><b>Example #1 OpenBSD Package Install Example</b></p>
<div class="example-contents programlisting">
<div class="shellcode"><pre class="shellcode"># pkg_add php4-core-4.3.8.tgz
# /usr/local/sbin/phpxs -s
# cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini
(add in mysql)
# pkg_add php4-mysql-4.3.8.tgz
# /usr/local/sbin/phpxs -a mysql
(add in imap)
# pkg_add php4-imap-4.3.8.tgz
# /usr/local/sbin/phpxs -a imap
(remove mysql as a test)
# pkg_delete php4-mysql-4.3.8
# /usr/local/sbin/phpxs -r mysql
(install the PEAR libraries)
# pkg_add php4-pear-4.3.8.tgz</pre>
</div>
</div>
</div>
<p class="simpara">
Read the <a href="http://www.openbsd.org/cgi-bin/man.cgi?query=packages" class="link external">» packages(7)</a>
manual page for more information about binary packages on OpenBSD.
</p>
</div>
<div id="install.unix.openbsd.ports" class="sect2">
<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/ports.html" class="link external">» ports tree</a>.
However, this is only recommended for users familiar with OpenBSD. The PHP 4 port
is split into two sub-directories: core and extensions. The
extensions directory generates 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 id="install.unix.openbsd.faq" class="sect2">
<h3 class="title">Common Problems</h3>
<ul class="itemizedlist">
<li class="listitem">
<span class="simpara">The default install of Apache runs inside a
<a href="http://www.openbsd.org/cgi-bin/man.cgi?query=chroot" class="link external">» 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, so
no special modification is needed there. More information on the OpenBSD Apache is available
in the <a href="http://www.openbsd.org/faq/faq10.html#httpdchroot" class="link external">» OpenBSD FAQ</a>.
</span>
</li>
<li class="listitem">
<span class="simpara">
The OpenBSD 3.6 package for the <a href="http://www.libgd.org/" class="link external">» gd</a> extension requires
XFree86 to be installed. If you do not wish to use some of the font features that
require X11, install the <var class="filename">php4-gd-4.3.8-no_x11.tgz</var> package instead.
</span>
</li>
</ul>
</div>
<div id="install.unix.openbsd.older" class="sect2">
<h3 class="title">Older Releases</h3>
<p class="simpara">
Older releases of OpenBSD used the FLAVORS system to compile up
a statically linked PHP. Since it is hard to generate binary packages using
this method, it is now deprecated. You can still use the old stable
ports trees if you wish, but they are unsupported by the OpenBSD team.
If you have any comments about this, the current maintainer for the port
is Anil Madhavapeddy (avsm at openbsd dot org).
</p>
</div>
</div><?php manual_footer(); ?>