Rhyous

November 6, 2009

How to install PHP5 and PHP5 Extensions on FreeBSD?

Filed under: FreeBSD — J. Abram barneck @ 9:58 am

Installing PHP5 on FreeBSD
There are two easy ways on FreeBSD:

From Ports

You can install easily from Ports. Make sure your ports tree is up to date:

$

su

Password:

ServerName#
ServerName#
ServerName#
portsnap fetch
portsnap extract
portsnap udpate

Then just do this to install PHP on FreeBSD.

ServerName#
ServerName#
cd /usr/ports/lang/php5
make install

You will be prompted for some options in an ncurses like window. If you want to use the defaults and not be prompted, use this command.

ServerName# make BATCH=yes install

PHP5 and its dependencies will download, compile, and install automagically for you.

From Packages

You can also install easily as a binary package with this simple command.

ServerName# pkg_add -r php

Installing PHP5 Extensions on FreeBSD
You may now want to install PHP5 extensions.

From Ports

You can install easily from Ports. Make sure your ports tree is up to date:

ServerName#
ServerName#
cd /usr/ports/lang/php5-extensions
make install

Select the php5-extensions you want to install when prompted.

PHP5-extensions and its dependencies will download, compile, and install automagically for you.

From Packages

You can also install easily as a binary package with this simple command.

ServerName# pkg_add -r php5-extensions

Integrating with Apache 2.x

  1. Change to the apache configuration directory: /usr/local/etc/apache22/
  2. Edit the httpd.conf with ee.
    ee httpd.conf
  3. Search for “DirectoryIndex” to find the section where the directory index is configured.
  4. Add index.php as the first item as shown:
    DirectoryIndex index.php index.html
  5. Change to the “Includes” directory which by default is here: /usr/local/etc/apache22/Includes
  6. Create a file that is named ending in .conf (I used php5.conf):
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
  7. Restart apache.

Copyright ® Rhyous.com – Linking to this article is allowed without permission and as many as ten lines of this article can be used along with this link. Any other use of this article is allowed only by permission of Rhyous.com.

Advertisements

3 Comments »

  1. […] How to install PHP5 and PHP5 Extensions on FreeBSD? […]

    Pingback by Installing an Apache + SSL on FreeBSD using the ports tree « Rhyous's 127.0.0.1 or ::1 — November 6, 2009 @ 10:00 am | Reply

  2. […] How to install PHP5 and PHP5 Extensions on FreeBSD? […]

    Pingback by Installing an Apache + SSL on FreeBSD using the ports tree « Rhyous's 127.0.0.1 or ::1 — November 6, 2009 @ 10:00 am | Reply

  3. […] How to install PHP5 and PHP5 Extensions on FreeBSD? […]

    Pingback by How to install dotProject 2.1.2 on FreeBSD 7.2 with Apache 2.2, PHP5, and MySQL 5.1 Server? « Rhyous's 127.0.0.1 or ::1 — January 19, 2010 @ 12:48 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: