Archive for the ‘Windows’ Category

h1

Getting PHP and MSSQL talking on Mac OSX

April 5, 2012

Here is what I had to do to get PHP talking to an MSSQL database on MAC OSX (Lion). Note that I am running Acquia dev desktop for PHP, you’ll have to change the paths to PHP if your setup is different.

Download Free TDS stable source from http://www.freetds.org/software.html and extract from the tarball.

Login as root with

sudo /usr/bin/bash

Go into freetds sources folder and configure freetds

CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure --prefix=/usr/local/freetds --enable-msdblib --with-tdsver=8.0

Compile freetds with

make && make install

Download and extract PHP sources for your version of PHP from http://php.net/downloads.php

Go into the php sources folder ext/mssql directory and configure

CFLAGS='-arch i386 -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7' ./configure --with-php-config=/Applications/acquia-drupal/php/bin/php-config --with-mssql=/usr/local/freetds

This will create a file called libtool

Go back to the freetds sources directory and run

make clean
CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure --prefix=/usr/local/freetds --enable-msdblib --with-tdsver=8.0

delete the freetds install
rm -rf /usr/local/freetds

copy the libtool file from the php sources ext/mssql directory to the freetds directory
cp /path/to/php-source/ext/mssql/libtool /path/to/freetds-source

Compile and install freetds again
make && make install

Go to the php-sources/ext/mssql directory and compile mssql
make

cp the so file to your php extensions dir
cp modules/mssql.so /Applications/acquia-drupal/php/ext

Edit your php.ini to include the mssql.so extension (e.g. with vim or nano)
vim /Applications/acquia-drupal/php/bin/php.ini

Add the following line in the Dynamic extensions section
extension=mssql.so

Tell the system where the FreeTDS config file is
echo "export FREETDSCONF=/usr/local/freetds/etc/freetds.conf" >> /etc/profile
echo "/usr/local/freetds/lib" >> /etc/ld.so.conf
ln -s /usr/local/freetds/bin/tds /usr/bin

and also run the followig (to save restarting your MAC)

export FREETDSCONF=/usr/local/freetds/etc/freetds.conf

Edit the freetds config file and set the freetds version to 8.0 (others dont seem to work with SQL server properly)
vim /usr/local/freetds/etc/freetds.conf
tds version = 8.0

Restart Web server

If you need help setting up SQLEXPRESS…

The basics…
http://codebetter.com/jefferypalermo/2005/11/04/how-to-use-sql-server-express-wheres-the-ui-level-200/

Setting up SQLEXPRESS for mixed login (windows authentication didn’t work for me from my remote PHP server)
http://eduzine.edujini-labs.com/archives/24-HOWTO-Configure-Microsoft-SQL-Server-for-Mixed-Mode-Authentication.html

Adding a new user account to sql express:
http://msdn.microsoft.com/en-us/library/aa337562.aspx

Let this new account access a db:
http://msdn.microsoft.com/en-us/library/aa337545.aspx

h1

Partition Wizard

January 12, 2012

Just used Partition Wizard 7 to resize Windows XP partitions from within Windows XP. Home edition is free and worked really well:
http://partitionwizard.com/