Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Sep 2004 19:57:36 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        steveb99 <steveb99@earthlink.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: FBSD 5.2.1, Apache 2, PHP
Message-ID:  <20040918185736.GA42643@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <20040918164334.1ACDB43D1F@mx1.FreeBSD.org>
References:  <s38y8j7og36.fsf@numerus.ling.uu.se> <20040918164334.1ACDB43D1F@mx1.FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--YZ5djTAD1cGYuMQK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Sep 18, 2004 at 09:43:33AM -0700, steveb99 wrote:
> =20
> 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. =20
>=20
> 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=3D	yes
    WITH_MYSQL_VER=3D	40   # Choose from 323, 40, 41 or 50
    DEFAULT_PHP_VER=3D	4    # Choose from 4 or 5=20
    WANT_PHP_MOD=3D       yes  # Want mod_php{4,5}  (*)

Other stuff you might want to set:

    WANT_PHP_CLI=3D       yes  # Install command line version of PHP (*)
    WANT_PHP_PEAR=3D	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.

	Cheers,

	Matthew

--=20
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

--YZ5djTAD1cGYuMQK
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFBTIUgiD657aJF7eIRAgVyAJ9ty2X4pUHXC8bhgCXs4+a5ClkO0wCgnFDL
QJlPhOzjNlOvyIfsFeIZujc=
=lX8C
-----END PGP SIGNATURE-----

--YZ5djTAD1cGYuMQK--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040918185736.GA42643>