{"id":24,"date":"2018-03-18T01:59:14","date_gmt":"2018-03-18T01:59:14","guid":{"rendered":"http:\/\/144.202.83.206\/?p=24"},"modified":"2021-07-10T18:02:04","modified_gmt":"2021-07-10T18:02:04","slug":"setting-up-httpd-php-pkg-chroot-for-wordpress-4-9-4-on-openbsd-6-2-part2","status":"publish","type":"post","link":"https:\/\/www.bigwisedata.com\/?p=24","title":{"rendered":"Setting up httpd, PHP, PKG, chroot for WordPress 4.9.4 on OpenBSD 6.2 part2"},"content":{"rendered":"<h2>PKG, Chroot, PHP oh my!<\/h2>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times;\">Welcome back to Installing WordPress 4.9.4 on OpenBSD 6.2.<span class=\"Apple-converted-space\">\u00a0 <\/span>In this installment we are going to look into enabling the httpd web server on OpenBSD 6.2, install php-7.0.23 and its associated components needed for serving WordPress PHP content.<span class=\"Apple-converted-space\">\u00a0 <\/span>Our goals for this post is to:<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Go over the PKG system for installing applications<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Discuss Chroot and httpd daemon<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Set up the PKG system to pull the binaries we require<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Install the php-7.0.23 components we need<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Configure php<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Configure and test the httpd_config.test file to server both html and php<\/li>\n<\/ol>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times;\">Much like we did with ssh,<span class=\"Apple-converted-space\">\u00a0 <\/span>we will test our php installs and the web server httpd using a combination of windows.<span class=\"Apple-converted-space\">\u00a0 <\/span><span style=\"font-kerning: none; color: #000000;\">We will be using two terminal sessions in two separate windows today:<\/span><\/p>\n<ol style=\"list-style-type: decimal;\">\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">A &#8220;VPS&#8221; in which we will be starting httpd sessions in debug mode<span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000;\">A \u201c<span style=\"font-kerning: none;\">Maintenance\u201d widow to be used to make any changes to your configuration files etc.<\/span><\/li>\n<\/ol>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Open a ssh connection using you Client window to your VPS as &#8220;bob&#8221; and su to root.<span class=\"Apple-converted-space\">\u00a0 <\/span>We will need root privileges to make our changes.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Lets create a test httpd configuration file to try our new changes in.<span class=\"Apple-converted-space\">\u00a0 <\/span>We will call this test httpd config file httpd_config.test.<span class=\"Apple-converted-space\">\u00a0 <\/span>To make the httpd_config.test, simply use &#8220;cp&#8221; to make a copy of \/etc\/examples\/http.config to a new name and place it into the \/etc directory.<span class=\"Apple-converted-space\">\u00a0 <\/span>The \/etc\/examples directory has a bunch of sample scripts to use as starting points.<span class=\"Apple-converted-space\">\u00a0 <\/span>Just remember to never use one directly, make a copy and place it in \/etc before editing.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 12.0px Courier; color: #000000;\"><span class=\"lang:sh decode:true crayon-inline \">cp \/etc\/examples\/httpd.config \/etc\/httpd_config.test<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Now edit the \/etc\/httpd.conf file in your favorite text editor to look like this:<\/span><\/p>\n<pre class=\"lang:sh decode:true\"># $OpenBSD: httpd.conf,v 1.14 2015\/02\/04 08:39:35 florian Exp $\r\n#\r\n# Macros\r\n#\r\next_addr=\"*\"\r\n#\r\n# Global Options\r\n#\r\n# prefork 3\r\n#\r\n# Servers\r\n#\r\n# A minimal default server\r\nserver \"default\" {\r\n\u00a0 \u00a0 \u00a0 \u00a0 listen on $ext_addr port 80\r\n\u00a0 \u00a0 \u00a0 \u00a0 root \u201c\/htdocs\u201d\r\ndirectory index \u201cindex.html\u201d\r\n}\r\ntypes {\r\n\u00a0 \u00a0 \u00a0 \u00a0 include \"\/usr\/share\/misc\/mime.types\"\r\n}<\/pre>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">This tells the httpd daemon to listen on all external IP addresses and take http requests on port 80 and process them by executing the index.html file located in \/var\/www\/htdocs using the mime type located in the file <\/span><span style=\"font-variant-ligatures: no-common-ligatures; background-color: #ffffff;\">\/usr\/share\/misc\/mime.types&#8221;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">We will change the httpd.conf to process requests properly in the future, but for now, this will get us up and testing.<\/span><span style=\"font-kerning: none;\"><span class=\"Apple-converted-space\">\u00a0 <\/span>Now in your editor create the \/var\/www\/htdocs\/index.html file and copy this into it:<\/span><\/p>\n<pre class=\"lang:sh decode:true \">&lt;html&gt;\r\n\u00a0 &lt;body&gt;\r\n\u00a0 \u00a0 &lt;h1&gt;This is my index.html test page&lt;\/h1&gt;\r\n\u00a0 &lt;\/body&gt;\r\n&lt;\/Html&gt;<\/pre>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">And save it.<span class=\"Apple-converted-space\">\u00a0 <\/span>Now it\u2019s time to test. <span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">&lt;Test&gt;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">In your VPS window make sure your running as root.<span class=\"Apple-converted-space\">\u00a0 <\/span>Now lets start or httpd in debug (-d) mode with verbosity turned to medium (-vv) using our httpd_config.test (-f \/etc\/httd_config.test)<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 18.0px; line-height: 14.0px; font: 11.0px Menlo; color: #000000;\"><span class=\"lang:sh decode:true crayon-inline \">httpd -d -vv -f \/etc\/httpd_config.test<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 18.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Open up your web browser and point it to http:\/\/&lt;IP address of your server&gt;.<span class=\"Apple-converted-space\">\u00a0 <\/span>You should see in rather large letters \u201cThis is my index.html test page\u201d displayed.<span class=\"Apple-converted-space\">\u00a0 <\/span>Now shut off the httpd debug session using ctrl+c in the VPS window.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">&lt;\/Test&gt;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">As we build up our system we will be performing similar tests to verify we have a working system as we configure each piece.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 28.0px Times;\"><b>$PKG_PATH<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Before we can install anything we will need to setup the Package Management(PKG) system on our VPS.<span class=\"Apple-converted-space\">\u00a0 <\/span>The PKG system is a collection of application and libraries the OpenBSD Ports Team has ported to the OpenBSD platform. <span class=\"Apple-converted-space\">\u00a0 <\/span>This collection has been vetted to the best of their abilities for security vulnerabilities and to insure compatibility with the OS itself.<span class=\"Apple-converted-space\">\u00a0 <\/span>An application may have dependencies on other binaries.<span class=\"Apple-converted-space\">\u00a0 <\/span>An application package when installed will check for those dependencies and will ask you if it can install them, if you agree, then it does.<span class=\"Apple-converted-space\">\u00a0 <\/span>In this way you get a completely installed program that uses shared dependencies with other programs, so it does not have to install the same file twice.<span class=\"Apple-converted-space\">\u00a0 <\/span>PKG relies on Mirrors which are stores located around the world of applications installs that are downloaded via HTTP or FTP protocol.<span class=\"Apple-converted-space\">\u00a0 <\/span>You must first setup the environment variable $PKG_PATH to a suitable Mirror near you that contains the binaries you are after,<span class=\"Apple-converted-space\">\u00a0 <\/span>and not all Mirrors contain the same applications so sometime you will need to look around.<span class=\"Apple-converted-space\">\u00a0 <\/span>I used the Mirror out of Boulder, Colorado<span style=\"font: 14.0px Cochin;\"> <a href=\"ftp:\/\/ftp3.usa.openbsd.org\/pub\/OpenBSD\/\"><span style=\"font: 14.0px Times; font-kerning: none; color: #23238e;\"><u>ftp:\/\/ftp3.usa.openbsd.org\/pub\/OpenBSD\/<\/u><\/span><\/a><\/span><span style=\"font-kerning: none; color: #23238e;\">. <span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span style=\"font-kerning: none;\">You need to provide a <i>complete<\/i> path to the package store which looks something like this \u201c<a href=\"ftp:\/\/ftp3.usa.openbsd.org\/pub\/OpenBSD\/6.2\/packages\/amd64\/\"><span style=\"font-variant-ligatures: no-common-ligatures;\">ftp:\/\/ftp3.usa.openbsd.org\/pub\/OpenBSD\/6.2\/packages\/amd64\/<\/span><\/a>\u201d.<span class=\"Apple-converted-space\">\u00a0 <\/span>But if you back up your user directories<span class=\"Apple-converted-space\">\u00a0 <\/span>like I do you will want to make this path dynamic incase you upgrade your OpenBSD to a newer version.<span class=\"Apple-converted-space\">\u00a0 <\/span>Restoring your root directory to the new system would point you to the wrong Mirror if this is hardcoded.<span class=\"Apple-converted-space\">\u00a0 <\/span>So lets make this dynamic:<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times;\"><span style=\"font-kerning: none;\">Connect to your VPS with your Maintenance window as bob and su to root and change directory to roots home directory<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times;\"><span class=\"lang:sh decode:true crayon-inline \">Cd ~<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times;\">In your favorite editor open the \u201c.profile\u201d.<span class=\"Apple-converted-space\">\u00a0 <\/span>Add the following lines after the export PATH statement<\/p>\n<pre class=\"lang:sh decode:true \">PKG_PATH=ftp:\/\/ftp3.usa.openbsd.org\/pub\/OpenBSD\/`uname -r`\/packages\/`uname -m`\/\r\nexport PKG_PATH<\/pre>\n<p style=\"margin: 0.0px 0.0px 5.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">On system startup or login, this loads a PKG_PATH variable for the root user only (because who else should be installing software on a server?) and exports it for use on the system.<span class=\"Apple-converted-space\">\u00a0 <\/span>The `uname -r` sets the current version of the OS and the `name -m` sets the processor sku that was installed dynamically.<span class=\"Apple-converted-space\">\u00a0 <\/span>Now you can copy the root .profile file to any server and the PKG_PATH will point to the correct package location.<span class=\"Apple-converted-space\">\u00a0 <\/span>Now exit out of root and su back in with the login switch (-l) so the .profile is reloaded then echo the PKG_PATH to confirm our change:<\/span><\/p>\n<pre class=\"lang:sh decode:true \">exit\r\nsu root -l\r\necho $PKG_PATH<\/pre>\n<p style=\"margin: 0.0px 0.0px 5.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">In my case I get \u201cftp:\/\/ftp3.usa.openbsd.org\/pub\/OpenBSD\/6.2\/packages\/amd64\/\u201d where \u201c6.2\u201d and \u201cand64\u201d are provided by the `uname -r` and `name -m` respectively.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 28.0px Times;\"><b>chroot<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">A quick word about chroot, sometimes referred to as a \u201csandbox\u201d and often <i>incorrectly<\/i> referred to as a \u201cjail\u201d.<span class=\"Apple-converted-space\">\u00a0 <\/span>Chroot (short for <b>ch<\/b>ange <b>root) <\/b>is a process where a given user or process is constrained to a subtree of a directory structure.<span class=\"Apple-converted-space\">\u00a0 <\/span>Once \u201cchrooted\u201d the process cannot see above the subtree and the top most path is now \u201c\/\u201c.<span class=\"Apple-converted-space\">\u00a0 <\/span>This keeps malicious users or bad code from trashing the whole file system as they cannot see or access anything outside of the chroot.<span class=\"Apple-converted-space\">\u00a0 <\/span>The OpenBSD web server httpd runs under <b>\/var\/www\/<\/b> and is chrooted to <b>\/var\/www<\/b>.<span class=\"Apple-converted-space\">\u00a0 <\/span>From httpds perspective, it runs under <b>\/<\/b>.<span class=\"Apple-converted-space\">\u00a0 <\/span>It cannot see above \/var\/www. Here is an example:<\/p>\n<p>&nbsp;<\/p>\n<table style=\"border-collapse: collapse;\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"width: 221.0px; padding: 0.0px 5.0px 0.0px 5.0px;\" valign=\"top\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">This is the directory structure of \/var.<\/p>\n<\/td>\n<td style=\"width: 257.0px; padding: 0.0px 5.0px 0.0px 5.0px;\" valign=\"middle\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">This is what httpd chrooted to \/var\/www sees<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 220.0px; padding: 0.0px 5.0px 0.0px 5.0px; border: 1.0px solid #cbcbcb;\" valign=\"top\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">\/var<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-Account<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-audit<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-authpf<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-backups<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-cache<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;fontconfig<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-crash<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-cron<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;atjobs<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;tabs<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-db<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;acpi<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;ldap<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;ns<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;pkg<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;colorls-6.0<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;quirks-2.367<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;xkb<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;yubikey<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-empty<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-games<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;hackdir<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;save<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;phantasia<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;save<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-log<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;rdist<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-mail<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-nsd<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;db<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;etc<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;run<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;xfr<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;zones<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;master<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;slave<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-quotas<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-run<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;rc.d<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-spool<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;ftp<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;bin<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;etc<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;hidden<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;lock<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;output<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;lpd<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;smtpd<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;corrupt<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;incoming<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;offline<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;purge<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;queue<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8212;-36<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8212;-9c<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;temporary<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-sysmerge<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-syspatch<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-unbound<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;db<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;etc<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><span style=\"color: #000000;\"><b><span class=\"Apple-converted-space\">\u00a0<\/span><\/b><\/span><b><span class=\"Apple-converted-space\">\u00a0 <\/span>|-www<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;acme<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;bin<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;cache<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;cgi-bin<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;conf<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;htdocs<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;&#8211;bgplg<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;logs<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;run<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\"><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-yp<\/p>\n<\/td>\n<td style=\"width: 256.0px; padding: 0.0px 5.0px 0.0px 5.0px; border: 1.0px solid #cbcbcb;\" valign=\"top\">\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b>\/<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-acme<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-bin<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-cache<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-cgi-bin<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-conf<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-htdocs<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|&#8212;bgplg<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-logs<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #ff0000;\"><b><span class=\"Apple-converted-space\">\u00a0\u00a0 <\/span>|-run<\/b><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Chroot generally means two things to us.<span class=\"Apple-converted-space\">\u00a0 <\/span>The first thing is that we have greatly reduced the threat surface of a malicious web user.<span class=\"Apple-converted-space\">\u00a0 <\/span>The second thing is, as we will see later, if we need <i>anything<\/i> outside of the chroot we need to copy it into the chroot to use it.<span class=\"Apple-converted-space\">\u00a0 <\/span>There are exceptions such as sockets but for the most part, you are confined to the chroot.<span class=\"Apple-converted-space\">\u00a0 <\/span>However it is not fool proof and should never be considered a \u201cJail\u201d.<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Cochin;\">Ok lets load the PHP packages we need for this project. Here is the list of applications we will need to grab:<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 18.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">php-7.0.23 &#8211; base PHP package<br \/>\nphp-gd-7.0.23 &#8211; PHP <\/span><span style=\"font-variant-ligatures: no-common-ligatures;\">image manipulation extensions<\/span><span style=\"font-kerning: none;\"><br \/>\nphp-mysqli-7.0.23 &#8211; PHP <\/span><span style=\"font-variant-ligatures: no-common-ligatures;\">mysql database access extensions<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 18.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">php-curl-7.0.23 &#8211; PHP command line Universal Resource Locator that <\/span><span style=\"font-variant-ligatures: no-common-ligatures;\">allows you to connect and communicate to those interfaces<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">The primary tools we will use for loading packages onto our system are pkg_info and pkg_add. <span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 28.0px Times;\"><b>pkg_info<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Pkg_info will allow us to query our Mirror to see whats available among other capabilities. An example of this would be \u201cpkg_info -Q \u201d&lt;name&gt;<span class=\"Apple-converted-space\">\u00a0 <\/span>searches for all packages with &lt;name&gt; in the name.<span class=\"Apple-converted-space\">\u00a0 <\/span>Do not include the version number in the query.<span class=\"Apple-converted-space\">\u00a0 <\/span>Found one your curious about?<span class=\"Apple-converted-space\">\u00a0 <\/span>Type pkg_info -q &lt;name&gt; and you\u2019ll get a brief synopsis of what it is for.<span class=\"Apple-converted-space\">\u00a0 <\/span>For example:<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">To find all php packages available on your Mirror\u2026<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 11.0px Menlo; color: #000000;\"><span class=\"lang:sh decode:true crayon-inline\">pkg_info -Q php<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Returns a list of applications with \u201cphp\u201d in the name:<\/span><\/p>\n<pre class=\"lang:sh decode:true\">drupal6-phpmailer-2.2p2\r\ngpsd-php-2.95p8\r\np5-PHP-Serialization-0.34\r\np5-PHP-Session-0.27\r\npear-Date-Holidays_PHPdotNet-0.1.2p1\r\nphp-5.5.37p0\r\nphp-5.6.23p0\r\nphp-7.0.23\r\n\u2026<\/pre>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">To find out what, say, php-7.0.23 is all about (mind the \u201cq\u201d &#8211; size matters here)\u2026<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 11.0px Menlo; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures;\"><span class=\"lang:sh decode:true crayon-inline\">pkg_info -q php-7.0.23<\/span><\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Returns a synopsis of that package:<\/span><\/p>\n<pre class=\"lang:sh decode:true\">server-side HTML-embedded scripting language\r\n\r\nphp-curl-7.0.23\r\nphp-gd-7.0.23\r\nphp-mysqli-7.0.23\r\n\r\nAt the most basic level, PHP can do anything any other CGI program can\r\ndo, such as collect form data, generate dynamic page content, or send\r\nand receive cookies.\r\n\r\nPHP also has support for talking to other services using protocols such\r\nas IMAP, SNMP, NNTP, POP3, or even HTTP. You can also open raw network\r\nsockets and interact using other protocols.\r\n\r\nThis package installs a stand-alone binary which can be used for\r\ncommand-line scripts, as well as an Apache module. It also contains the\r\npdo_sqlite driver that implements the PHP Data Objects (PDO) interface\r\nto enable access to SQLite 3 databases.\r\n\r\nMaintainer: Robert Nagy &lt;robert@openbsd.org&gt;\r\n\r\nWWW: http:\/\/www.php.net\/<\/pre>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Don\u2019t be fooled, the php applications listed in the synopsis are not dependencies,<span class=\"Apple-converted-space\">\u00a0 <\/span>they are just part of the synopsis, included at the authors discretion.<span class=\"Apple-converted-space\">\u00a0 <\/span>If you want to see the dependencies,<span class=\"Apple-converted-space\">\u00a0 <\/span>we have a switch (-f) for that.<span class=\"Apple-converted-space\">\u00a0 <\/span>But it dumps everything about the package, we will need to filter it a bit using grep:<\/span><\/p>\n<p><span class=\"lang:sh decode:true crayon-inline\">pkg_info -f php-7.0.23 | grep &#8216;^@depend&#8217; | cut -f 3 -d :<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Returns:<\/span><\/p>\n<pre class=\"lang:sh decode:true \">gettext-0.19.7\r\nfemail-chroot-1.0p2\r\nlibxml-2.9.3<\/pre>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Bare in mind each dependency most likely has its own list of dependencies it needs to install.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Now you know what php-7.0.23 is and what it is used for and what will get installed besides php-7.0.23 to make php-7.0.23 work correctly.<span class=\"Apple-converted-space\">\u00a0 <\/span>Kinda cool huh?<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 28.0px Times;\"><b>pkg_add<\/b><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; line-height: 14.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-kerning: none;\">Pkg_add will install (or update) an application.<span class=\"Apple-converted-space\">\u00a0 <\/span>It also has some useful switches but I leave those up to you dear reader to explore.<span class=\"Apple-converted-space\">\u00a0 <\/span>To use pkg_add is fairly simple:<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000;\"><span class=\"lang:sh decode:true crayon-inline\">pkg_add -n php-7.0.23<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Will show what would be installed but does not do the install and list the dependencies of the package to be installed with a extraction progress indicator by %.<span class=\"Apple-converted-space\">\u00a0 <\/span>It will tell you if any new scripts were installed in \/etc\/rc.d and where to look in \/usr\/local\/share\/doc\/pkg_readmes for extra documentation<span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000;\"><span class=\"lang:sh decode:true crayon-inline\">pkg_add php-7.0.23<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Installs the package and gives you the same output as<span class=\"Apple-converted-space\">\u00a0<\/span><\/span><span style=\"font: 11.0px Menlo; font-variant-ligatures: no-common-ligatures;\"> pkg_add -n php-7.0.23.<\/span> <span style=\"font-variant-ligatures: no-common-ligatures;\">You can list several packages on the same call to pkg_add.<span class=\"Apple-converted-space\">\u00a0 <\/span>I prefer to call them one at a time.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times;\">Ok onto the installs.<span class=\"Apple-converted-space\">\u00a0 <\/span>This is the easy part because a lot of developers who donate their time to the OpenBSD project have made it that way.<span class=\"Apple-converted-space\">\u00a0 <\/span>In your terminal as root run the following commands:<\/p>\n<pre class=\"lang:sh decode:true \">pkg_add php-7.0.23\r\npkg_add php-curl-7.0.23\r\npkg_add php-gd-7.0.23\r\npkg_add php-mysqli-7.0.23<\/pre>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times;\">To see everything that has bee installed on your system, typing pkg_info by itself will give you a list of everything currently installed:<\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline \">pkg_info<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Returns:<\/span><\/p>\n<pre class=\"lang:sh decode:true \">colorls-6.0 \u00a0 \u00a0 \u00a0 \u00a0 ls(1) that can use color to display file attributes\r\ncurl-7.55.1 \u00a0 \u00a0 \u00a0 \u00a0 get files from FTP, Gopher, HTTP or HTTPS servers\r\nfemail-1.0p1\u00a0 \u00a0 \u00a0 \u00a0 simple SMTP client\r\nfemail-chroot-1.0p2 simple SMTP client for chrooted web servers\r\ngettext-0.19.8.1p1\u00a0 GNU gettext runtime libraries and programs\r\njpeg-1.5.1p0v0\u00a0 \u00a0 \u00a0 SIMD-accelerated JPEG codec replacement of libjpeg\r\nlibiconv-1.14p3 \u00a0 \u00a0 character set conversion library\r\nlibxml-2.9.5\u00a0 \u00a0 \u00a0 \u00a0 XML parsing library\r\nmariadb-client-10.0.32v1 multithreaded SQL database (client)\r\nnghttp2-1.26.0\u00a0 \u00a0 \u00a0 library for HTTP\/2\r\nphp-7.0.23\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 server-side HTML-embedded scripting language\r\nphp-curl-7.0.23 \u00a0 \u00a0 curl URL library extensions for php5\r\nphp-gd-7.0.23 \u00a0 \u00a0 \u00a0 image manipulation extensions for php5\r\nphp-mysqli-7.0.23 \u00a0 mysql database access extensions for php5\r\npng-1.6.31\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 library for manipulating PNG images\r\nquirks-2.367\u00a0 \u00a0 \u00a0 \u00a0 exceptions to pkg_add rules\r\nxz-5.2.3p0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 LZMA compression and decompression tools<\/pre>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times;\">We now have our php components installed.<span class=\"Apple-converted-space\">\u00a0 <\/span>But before we can use them we have to configure them.<span class=\"Apple-converted-space\">\u00a0 <\/span>To do that we need to:<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Set up an \/var\/www\/htdocs\/index.php to test with<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Alter the \/etc\/httpd_config.test file<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Create the empty \/etc\/rc.conf.local file<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Enable and start the php daemon.<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Check your work using your web browser<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Configure curl in php7.0.ini<\/li>\n<li style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times;\">Check your work using your web browser to see if curl was configured.<\/li>\n<\/ol>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times;\">Lets create the \/var\/www\/htdocs\/index.php by using touch.<\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline \">touch \/var\/www\/htdocs\/index.php<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Now using your favorite editor change the empty file contents to:<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline \">&lt;?php phpinfo(); ?&gt;<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Save Index.php.<span class=\"Apple-converted-space\">\u00a0 <\/span>Now edit \/etc\/httpd_config.test and change the contents of the server block<span class=\"Apple-converted-space\">\u00a0 <\/span>to the following:<\/span><\/p>\n<pre class=\"lang:sh decode:true \"># A minimal default server\r\nserver \"default\" {\r\n\u00a0 \u00a0 \u00a0 \u00a0 listen on $ext_addr port 80\r\n\u00a0 \u00a0 \u00a0 \u00a0 root \"\/htdocs\"\r\n# \u00a0 \u00a0 \u00a0 directory index \"index.html\"\r\n\u00a0 \u00a0 \u00a0 \u00a0 directory {\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 index \"index.php\"\r\n\u00a0 \u00a0 \u00a0 \u00a0 }\r\n\u00a0 \u00a0 \u00a0 \u00a0 location \"*.php\" {\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 fastcgi socket \"\/run\/php-fpm.sock\"\r\n\u00a0 \u00a0 \u00a0 \u00a0 }\r\n}<\/pre>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Save the \/etc\/httpd_config.test.<span class=\"Apple-converted-space\">\u00a0 <\/span>Now lets enable PHP.<span class=\"Apple-converted-space\">\u00a0 <\/span>We need to make a \/etc\/rc.conf.local using touch.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline \">Touch \/etc\/rc.conf.local<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Now using rcctl we will enable php fastcgi socket to run<\/span><\/p>\n<p><span class=\"lang:sh decode:true crayon-inline\">rcctl enable php70_fpm<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">You can check the \/etc\/rc.conf.local file,<span class=\"Apple-converted-space\">\u00a0 <\/span>you should see one line in there that looks like this:<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline\">pkg_scripts=php70_fpm<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Start the php70_fpm using rcctl<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline\">rcctl start php70_fpm<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures; background-color: #ffffff;\">Start your httpd debug session in its own window as we did before.<span class=\"Apple-converted-space\">\u00a0 <\/span><\/span><span style=\"font-kerning: none;\">Open up your web browser and point it to http:\/\/&lt;IP address of your server&gt;.<span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>You should see the rather large summary of php components available to your web service.<span class=\"Apple-converted-space\">\u00a0 <\/span>But we are missing the \u201ccommand line URL\u201d processor or \u201ccurl\u201d component.<span class=\"Apple-converted-space\">\u00a0 <\/span>We need to configure that in the <\/span><span style=\"font-variant-ligatures: no-common-ligatures; background-color: #ffffff;\">\/etc\/php-7.0.ini.<span class=\"Apple-converted-space\">\u00a0 <\/span>Open the \/etc\/php-7.0.ini and scroll down to the extension section, it looks a lot like this:<\/span><\/p>\n<pre class=\"lang:sh decode:true\">;;;;;;;;;;;;;;;;;;;;;;\r\n; Dynamic Extensions ;\r\n;;;;;;;;;;;;;;;;;;;;;;\r\n; If you wish to have an extension loaded automatically, use the following\r\n; syntax:\r\n;\r\n; \u00a0 extension=modulename.extension\r\n;\r\n; For example, on Windows:\r\n;\r\n; \u00a0 extension=msql.dll\r\n;\r\n; ... or under UNIX:\r\n;\r\n; \u00a0 extension=msql.so\r\n;\r\n; ... or with a path:\r\n;\r\n; \u00a0 extension=\/path\/to\/extension\/msql.so\r\n;\r\n; If you only provide the name of the extension, PHP will look for it in its\r\n; default extension directory.\r\n;\r\n; Windows Extensions\r\n; Note that ODBC support is built in, so no dll is needed for it.\r\n; Note that many DLL files are located in the extensions\/ (PHP 4) ext\/ (PHP 5+)\r\n; extension folders as well as the separate PECL DLL download (PHP 5+).\r\n; Be sure to appropriately set the extension_dir directive.\r\n;\r\n;extension=php_bz2.dll\r\n;extension=php_curl.dll\r\n;extension=php_fileinfo.dll\r\n;extension=php_ftp.dll\r\n;extension=php_gd2.dll\r\n\u2026<\/pre>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Verify the path to the curl.so using find.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline\">find \/ -name curl.so<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">Add the following line at the end of the extension section:<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000;\"><span class=\"lang:sh decode:true crayon-inline\">extension=\/usr\/local\/lib\/php-7.0\/modules\/curl.so<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000;\">Save the \/etc\/php7.0.ini and restart php using rcctl<\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline\">rcctl restart php70_fpm<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures; background-color: #ffffff;\">Start your httpd debug session in its own window as we did before.<span class=\"Apple-converted-space\">\u00a0 <\/span><\/span><span style=\"font-kerning: none;\">Open up your web browser and point it to http:\/\/&lt;IP address of your server&gt;.<span class=\"Apple-converted-space\">\u00a0 <\/span>You should see the rather large summary of php components available to your web service, including a section called \u201cCurl\u201d.<span class=\"Apple-converted-space\">\u00a0 <\/span>This<span class=\"Apple-converted-space\">\u00a0 <\/span>good as WordPress uses curl to process requests for plugins and themes.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000; min-height: 18.0px;\"><span style=\"font-kerning: none;\"><span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000;\">Ok, enough fun for today.<span class=\"Apple-converted-space\">\u00a0 <\/span>Lets shutdown our httpd by executing a ctrl+c in the window running it.<span class=\"Apple-converted-space\">\u00a0 <\/span>The php daemon will now start automatically when the server is restarted.<span class=\"Apple-converted-space\">\u00a0 <\/span>If you want to shut php down as well, use rcctl.<\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff;\"><span class=\"lang:sh decode:true crayon-inline \">rcctl stop php70_fpm<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000; background-color: #ffffff;\"><span style=\"font-variant-ligatures: no-common-ligatures;\">The httpd will be enabled later using rcctl after we have a working WordPress install.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 12.0px 0.0px; font: 14.0px Times; color: #000000;\"><span style=\"font-variant-ligatures: no-common-ligatures; background-color: #ffffff;\">It is better to keep your web server offline until you have it secured against malicious intruders.<\/span><\/p>\n<p style=\"margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Times; color: #000000;\">So today we have accomplished quite a lot.<span class=\"Apple-converted-space\">\u00a0 <\/span>I went over the PKG system, how to configure it and some basic techniques on how to use it.<span class=\"Apple-converted-space\">\u00a0 <\/span>I discussed httpd daemon and the chrooted environment it runs in.<span class=\"Apple-converted-space\">\u00a0 <\/span>We set up the httpd_config.test file for testing our httpd configuration and ran it in debug mode as we tested first HTML file and later PHP file serving.<span class=\"Apple-converted-space\">\u00a0 <\/span>We installed all of our php components, created the rc.conf.local file and enabled php and configured CURL and the php70_fpm fastcgi socket to work in our chrooted httpd environment. All in all a good day.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PKG, Chroot, PHP oh my! Welcome back to Installing WordPress 4.9.4 on OpenBSD 6.2.\u00a0 In this installment we are going to look into enabling the httpd web server on OpenBSD 6.2, install php-7.0.23 and its associated components needed for serving WordPress PHP content.\u00a0 Our goals for this post is to: Go over the PKG system &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.bigwisedata.com\/?p=24\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Setting up httpd, PHP, PKG, chroot for WordPress 4.9.4 on OpenBSD 6.2 part2&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[2,3],"tags":[7],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-openbsd","category-wordpress","tag-httpd-php-pkg-chroot-wordpress-openbsd"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9IcIr-o","jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24"}],"version-history":[{"count":17,"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=\/wp\/v2\/posts\/24\/revisions"}],"predecessor-version":[{"id":260,"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=\/wp\/v2\/posts\/24\/revisions\/260"}],"wp:attachment":[{"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bigwisedata.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}