Impossible tri-bar

Digital Phenomena - Your first stop for internet consultancy 
PHP4 Installation Overview

Page 6 — Modifying Your Installation (Non-Windows)

I keep harping on the fact that with a DSO, you can swap out PHP functionality as you see fit. Well here's a practical example. Suppose when you originally installed PHP, you followed the exact configuration I described earlier, i.e., you installed the DSO installation plus MySQL support by entering a configure line that looks like this:

./configure --with-mysql=/[path to mysql] --with-apxs=/[path to apxs]

You built the module, restarted Apache, and all was well and good. You go on for awhile, happily coding PHP. Then you decide to get all crazy and instead of MySQL, you start using Oracle 8. Additionally, you want to create images dynamically and work with encryption and hashing functions. Oh my, what to do?!

First enter the PHP installation directory and type the following at the prompt:

make clean

This command blows away any configuration caches and makefiles, so that your new build doesn't get hung up on old values.

Next, just type a new configure line for all those crazy things mentioned above, something like this:

./configure --with-apxs=/usr/local/bin/apache/bin/apxs 
--with-gd=/usr/local/lib/gd1.3
--with-zlib-dir=/usr/local/lib/zlib-1.1.3 
--with-mcrypt=/usr/local/bin/libmcrypt-2.2.6/lib
--with-mhash=/usr/local/bin/mhash-0.7.0 --with-oci8

Whoa! That's way more functionality than simple MySQL support. After the configuration script does its thing and puts you back at the prompt, type:

make
Watch the makefiles build the module, and wait for the prompt. When the prompt returns, and you've received no errors, type:

make install

Again, "make install" just plops the final module into the Apache modules directory. Since the necessary modifications were made to httpd.conf during the first instance of the DSO installation, you don't need to make them again. All you should do is verify that the new module has the proper date and time, and restart Apache. If you load another phpinfo() file, you should see your modified configuration options. Easy as pie.

If you were interested in adding the same functionality to a static module installation of PHP, at this point you'd go back to the Apache installation directory and configure and build it again, activating the static PHP module. This takes more time, especially if you have a complicated Apache installation that would have to be re-built. Of course, it's up to you whether you use a static or dynamic module -- I can espouse my preference for the DMO until I'm blue in the face, but you'll do what you want, and that's just fine. It's just that I like keeping things separate, as the more closely intertwined two things are, the harder it is to separate and pinpoint problems when they arise. I'm too busy for challenges these days -- I'm sure a lot of you are, too.

So ends the basic installation instructions for getting up and running with PHP4 on a non-Windows platform. One final tip: The more functionality you add to your installation, the more libraries and what-not will need to exist (and in the right places). In other words, the more chances for things to fail the first time around, until you get your ducks in a row. Nine times out of 10, an installation problem has a simple fix (by simply tracking down a library or two and re-configuring). For those difficult times, however, the PHP-install mailing list is, as I said before, an extremely valuable resource. And when you become a pro at installing and configuring PHP, you might want to hang out on the mailing list for a little while, just to return the favor by helping out. Or maybe you'll be too busy learning how to do it all again, but this time in Windows (but if you're not quite ready for that, please jump ahead to learn about some Tweaky Things About php.ini).

next page»


|Home|About Us|Services|Search|
|Software|Products|Support|Links|Latest|
W3C validatedW3C validated CSSCompatible with all browsers