This solution worked for my Ubuntu box, thank goodness for apt-get (although any competent Linux person should be able to get where they need to go with compiling from source). Again, I'm actually compiling Apache and PHP from source. It's better that way. Now, bare with me, I've done this ahead of time and am just recapping what I've done to try and help others.
Prerequisite step:
Make sure your distribution and tools are up to date. A simple command for this in Ubuntu was:
sudo apt-get install build-essential
some resources I've seen recommend:
sudo apt-get install build-essential flex libncurses5-dev libxml2-dev
First, you obviously need to set up Apache.
Get the source here:
http://www.apache.org/dist/httpd/
Extract it in your usual fashion. Mine was:
tar -zxvf http-2.2.6.tar.gz
CD into the directory and then run:
./configure --enable-so --enable-modules=most
make
sudo make install
at this point you can test the install, but for your information my Apache installed into /usr/local/apache2/
sudo /usr/local/apache2/bin/apachectl start
sudo /usr/local/apache2/bin/apachectl stop
Now when you visit 127.0.0.1 it should show something like "It works" (if it worked!). Congratulations, you've successfully set up an Apache web server.
Second, it's time to install PHP (and add MSSQL support!)
In order for PHP to set up MSSQL support successfully, you'll need FreeTDS (or a similar sybase-esque connector, so I've heard). Contrary to popular belief, you don't need to mess around with ODBC at all.
For me, on Ubuntu 7.10 all I had to do was run:
sudo apt-get install freetds-dev
For others, you'll need to compile this from source most likely:
http://www.freetds.org/software.html
You're on your own for that one, although I'd suspect it's not too much different from any other compilation procedure.
Get PHP's source, here:
http://www.php.net/downloads.php
Again, extract the source:
tar -zxvf php-5.2.5.tar.gz
CD into the directory and run the configuration:
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--disable-debug \
--enable-inline-optimization \
--enable-magic-quotes \
--enable-wddx=shared \
--enable-xml \
--with-gd \
--with-zlib-dir=/usr/lib \
--with-mssql
make
sudo make install
Once this is done, you'll need to copy the php.ini to the proper location.
sudo cp php.ini-dist /usr/local/lib/php.ini
Now you'll want to edit your httpd.conf file to reflect that you've installed php.
Open the file /usr/local/bin/apache2/conf/httpd.conf in your favorite text editor
(mine is pico, I can't stand vi)
Find the respective lines that say something like LoadModule in the conf file and add the following:
LoadModule php5_module modules/libphp5.so
You'll also want to find in the conf file where the lines AddType are located, modify them to contain:
AddType application/x-httpd-php .php
Once you've done this you'll want to go ahead and edit your php.ini (/usr/local/lib/php.ini) and uncomment the line that says (which I don't know why):
extension=php_mssql.dll
Once you've done this, go ahead and do:
sudo /usr/local/apache2/bin/apachectl restart
And with any luck, you'll be all set for your apache-php-MSSQL and Linux adventures!
Good luck and let me know how it went!
Resources:
Some resources I've used in the past to do this sort of thing:
http://www.php.net/manual/en/install.unix.php
http://eightpence.com/running-multi-threaded-apache-with-php-on-ubuntu/
http://narnia.cs.ttu.edu/drupal/node/100
http://panthar.org/2006/06/15/php-with-mssql-on-ubuntu-606/
Each one will teach you different things, I've used pretty much all of them at one point or another
EmoticonEmoticon