Table of Contents



by ross at 06:46:09 on August 1, 2014

In order to get PHP running on FreeBSD you install the core port and then the extensions you need (each extension is in a separate port).

# cd /usr/ports/lang/php5
# make config

The options:

  • CLI - Command line php binary
  • CGI - (Fast)CGI binary php-cgi
  • FPM - FastCGI Process Manager - alternative FastCGI implementation
  • ZTS - Thead Safety mode - required if you are going to use PHP with a threaded server
# make install clean
​# rehash


Now when you have the engine it's time fo extensions:

When you install any DB support PHP extension it will automatically install this particular DB client libraries. Chances are that these client libs will be of an old version. To avoid version mismatch simply install the database server of version your want before installing the PHP extension.

# cd /usr/ports/lang/php5-extensions
# make config
# make install clean

This is a meta-port listing main PHP extensions. You check the option and it will install the port of this extension. But the list is not complete, for example, pecl-* extensions you will have to install by hand:

# cd /usr/ports/devel/pecl-intl
# make install clean