FBSD 5.2.1, Apache 2, PHP

Matthew Seaman m.seaman at infracaninophile.co.uk
Sat Sep 18 11:57:46 PDT 2004

On Sat, Sep 18, 2004 at 09:43:33AM -0700, steveb99 wrote:
> I keep looking for a how-to or other information on setting up FreeBSD
> 5.2.1, Apache 2, PHP, and MySQL, but not finding much.  I do find
> things using Apache 1.3, but not 2.  I want to have a setup similar to
> what I develop on at work, but work is using Linux.  
> Is this a workable configuration on FreeBSD?  If so can someone point
> me to some FAQ, how-to, notes, comments, etc.

Works for me, except I'm running 4.10 rather than 5.2.1.  Installing
all that stuff via ports is the way to go -- it's pretty easy really,
which might explain the relative paucity of anyone writing up how-tos.

Here's a handy tip.  You can control what versions of apache, PHP and
MySQL are installed by setting some make(1) variables.  First, make
sure that your ports tree is up to date using cvsup(1).

To set the variables for make(1) to use, there are quite a few
options, but the simplest and most effective is to add the settings to
/etc/make.conf.  You'll want to add:

    WITH_APACHE2=	yes
    WITH_MYSQL_VER=	40   # Choose from 323, 40, 41 or 50
    DEFAULT_PHP_VER=	4    # Choose from 4 or 5 
    WANT_PHP_MOD=       yes  # Want mod_php{4,5}  (*)

Other stuff you might want to set:

    WANT_PHP_CLI=       yes  # Install command line version of PHP (*)
    WANT_PHP_PEAR=	yes  # If you want the PEAR framework (*)

The three settings marked (*) are really only meant to be used by port
maintainers. However there as there aren't any handy user oriented
ways of choosing those settings, you've got to bend the rules a bit.
Also not that quite a lot of PHP software available from the 'net does
not yet work with PHP5.

You can combine WANT_PHP_CLI and WANT_PHP_MOD -- see
/usr/ports/Mk/bsd.php.mk for a number of other variables you can set
to achive other PHP configurations.  Beware though -- some of those
settings are mutually incompatible.

Now, you should be able to install apache2 etc. by utilising the
dependencies built into the ports system:

    # cd /usr/ports/databases/php4-mysql       (or php5-mysql)
    # make install

That will install the MySQL client-side software as one of the
dependencies, along with apache2 and mod_php4.  If you want to install
the MySQL server as well, then do:

    # cd /usr/ports/databases/mysql40-server
    # make install

All of the php extensions are not installed as separate ports -- use
the lang/php{4,5}-extensions port to select and install exactly what
extensions you want. (Hint: almost everything wants the pcre
extension) See ports(7) for the explanation of the 'make configure',
'make showconfig' and 'make rmconfig' commands.

Now, you will need to add the correct variables to /etc/rc.conf to get
those servers started up at system boot (see the scripts installed
into /usr/local/etc/rc.d for instructions), and you'll have to edit
the configuration files for apache and MySQL along with installing web
and database content.



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040918/4e9a5d1a/attachment.bin

More information about the freebsd-questions mailing list