OpenBSD Kurulum Bilgiler

Bu bölüm PHP'nin » OpenBSD sistemlere kurulumu hakkında bilgiler ve ipuçları içerir.

İkil Paketlerin Kullanımı

PHP'yi OpenBSD üzerine kurmak için ikil paketlerin kullanımı en basit ve önerilen bir yoldur. Temel paket, modül paketlerinden ayrıdır ve her modül paketi diğerlerinden bağımsız olarak kurulup kaldırılabilir. İhtiyaç duyacağınız dosyaları OpenBSD CD'nizde veya FTP sitesinde bulabilirsiniz.

İhtiyacınız olan ana paket php olup, temel motoru (artı fpm, gettext ve iconv) içerir ve aralarından seçim yapabileceğiniz çeşitli sürümler de mevcut olabilir. Modül paketleri ise php-mysql veya php-imap gibi isimler alırlar. Bu modülleri php.ini dosyanızda etkin ve etkisiz kılmak için phpxs komutuna ihtiyacınız olacak.

Örnek 1 - OpenBSD Paket Kurulum Örneği

# pkg_add php
# pkg_add php-apache
# pkg_add php-mysqli
  (PEAR kütüphanesini kur)
# pkg_add pear

Paketlerle ilgili talimatları izle
  (paketleri kaldırmak için)
# pkg_delete php
# pkg_delete php-apache
# pkg_delete php-mysqli
# pkg_delete pear

OpenBSD'deki ikil paketler hakkında ayrıntılı bilgi edinmek için » packages(7) kılavuz sayfasını okuyunuz.

Portların Kullanımı

Ayrıca, PHP'yi kaynak paketinden » port ağacını kullanarak da derleyebilirsiniz. Ancak, bu sadece OpenBSD üzerinde tecrübeli kullanıcılar için önerilebilecek bir yoldur. PHP portu iki alt dizine ayrılır: çekirdek ve eklentiler. Eklentilerin bulunduğu dizin desteklenen tüm PHP modülleri için alt paketler üretir. Bu modüllerden üretilmesini istemedikleriniz için no_* FLAVOR'unu kullanınız. Örneğin imap modülünün derlenmeden geçilmesi için FLAVOR'a no_imap atayınız.

Bilinen Sorunlar

  • Apache ve Nginx artık OpenBSD'nin öntanımlı sunucusu olmamakla beraber her ikiksi de portlarda ve paketlerde kolayca bulunabilir. Yeni öntanımlı sunucu 'httpd'dir.
  • httpd'nin öntanımlı kurulumu bir » chroot(2) hücresinde çalışır, böylece PHP betiklerinin /var/www altındaki dosyalara erişmesi engellenir. Bu bakımdan PHP oturum dosyalarının saklanması için ya /var/www/tmp diye bir dizine ya da başka bir oturum arayüzü kullanmaya ihtiyacınız olacaktır. Buna ek olarak, veritabanı soketlerinin de hücre içine yerleştirilmesi veya localhost arayüzünü dinlemesi gerekir. Ağ işlevleri kullanıyorsanız, /etc dizinindeki /etc/resolv.conf ve /etc/services gibi dosyaların /var/www/etc dizinine taşınması gerekecektir. OpenBSD PEAR paketi otomatik olarak doğru chroot dizinlerine kurulur.
  • » gd eklentisi için, OpenBSD paketi Xorg'un kurulu olmasını gerektirir. xbase.tgz dosya kümesi eklenerek temel kurulumda zaten kurulmadıysa, kurulum sonrasında eklenebilir (Bkz: » OpenBSD FAQ#4).
add a note

User Contributed Notes 6 notes

up
18
Anonymous
2 years ago
UPDATE: OpenBSD 6.9:

- The package "php-fpm" no longer exists. It's the default, so you can just install "php".
- The /var/www/tmp directory will be created automatically when you install PHP.
- PHP 8 is available :D as well as older versions. pkg_add will ask you which version to install.
up
20
pete att shitnami.net
8 years ago
A brief update: As of OpenBSD 5.7 (2015) the installation process is extremely easy. Apache httpd was replaced by Nginx, which has since been further replaced by OpenBSD's own server, aptly named 'httpd'.

'httpd' is installed by default, everything else you can still get from packages, with a couple name changes (including Apache and Nginx.) You will be asked which version to install - at the time of writing, versions 5.3.29p1 thru 5.6.5 are available.

#pkg_add php
#pkg_add php-fpm
#pkg_add pear

----
OpenBSD disables most services by default; a blank '_flags' line overrides default 'NO' value. pkg_scripts are located in /etc/rc.d/
To start at boot, edit "/etc/rc.conf.local":

httpd_flags=
pkg_scripts=php_fpm

----
Example /etc/httpd.conf
#
# paths are relative to chroot - e.g, '/var/www/run/php-fpm.sock'
server "default" {
listen on * port 80
location "*.php" {
fastcgi socket "/run/php-fpm.sock"
}
directory index index.php
root "/htdocs"
}

----
For date, timezone issues, copy /etc/localtime:
$cp /etc/localtime /var/www/etc/localtime

If 'localhost' DNS name fails to resolve, copy /etc/hosts
$cp /etc/hosts /var/www/etc/hosts
up
7
ameen(at)dausha(dot)net
20 years ago
I just finished spinning my wheels with PHP/Apache on OpenBSD 3.3, and it took a Google to fix my problem. I followed the instructions by (0429196301 at netcabo dot pt) written on Sep 19, 2003 and kept being fed a segmentation fault when I tried to start httpd.

Then I read the page cited below that suggested playing with the order of the LoadModules, and put the PHP first. I followed that recommendation and httpd started without problems!

Page that saved me:
http://archives.neohapsis.com/archives/openbsd/2002-04/3074.html

"Change around the order of the Apache modules, this is one of the
drawbacks to the module API for Apache 1.3 is that the order is very
important. I would try making the PHP 4 module first, Perl module second
and FP module last. "
up
6
openbsd-fanatic
18 years ago
I am user that is just migrating to open source and thought I would take openbsd for a spin. This article, by Gregory L. Magnusson, really helped me to get a working apache-php-mysql server going on openbsd.
http://www.devx.com/security/Article/28059/0/page/1
up
3
sanchero [at] gvsu [dot] edu
20 years ago
On OpenBSD 3.2, given the steps outlined above using pre-built packages you will get a new "/var/www/conf/httpd.conf" that contains a section like this:

<IfDefine SSL>
AddModule mod_ssl.c
AddModule mod_php4.c
</IfDefine>

This causes mod_php4 to load only when starting Apache w/SSL, so if this isn't what you want add the mod_php4 line again above (or below) this section, like so:

AddModule mod_php4.c <<------ SEE? - now should load normally.
<IfDefine SSL>
AddModule mod_ssl.c
AddModule mod_php4.c
</IfDefine>

I also added this for good measure:

<IfModule mod_php4.c>
AddType application/x-httpd-php .php [blah blah]
</IfModule>

Seems to work.
up
-2
hg at ostc dot de
18 years ago
Also you should add "-a /var/www/dev/log" to the syslogd_flags
for propper logging of php-extensions like imap.so and create
a /var/www/etc/master.passwd with an www-user-entry and run
pwd_mkdb -d /var/www/etc /var/www/etc/master.passwd for propper
use of libc-client.a functions in imap.so.
To Top