This section contains notes and hints specific to installing PHP on » OpenBSD.
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.
The main package you need to install is php, 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 php-mysqli or php-imap. You need to use the phpxs command to activate and deactivate these modules in your php.ini.
Example #1 OpenBSD Package Install Example
# 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
Read the » packages(7) manual page for more information about binary packages on OpenBSD.
You can also compile up PHP from source using the » ports tree. 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 no_* FLAVOR. For example, to skip building the imap module, set the FLAVOR to no_imap.