FreeTDS worked well for me a million years ago (okay the year 2000), but I didn't need to access blob fields for the application I was building so YMMV
Harvey, if Jochen's run-through works for you, you may owe him a malted beverage ... or three ;) Regards, Paul Bennett Account Manager Crackerjack Digital - Web and Mobile Development for Creative Agencies http://www.crackerjack.net.nz Crackerjack Hosting - Exceptional Web Hosting http://www.crackerjackhq.com Level 15, 171 Featherston St, Wellington 0800 895 600 027 255 8495 On Fri, Apr 11, 2014 at 1:46 PM, Jochen Daum <[email protected]> wrote: > Sorry, > > I just remembered the most important part. Most tutorials on the web > suggest to use FreeTDS for accessing SQL Server. This didn't work for me as > it can't seem to read blob fields beyond 64KB. > > Jochen > > > On 11 April 2014 13:40, Jochen Daum <[email protected]> wrote: > >> Hi Harvey, >> >> I've been through setting up (again) PHP with SQL Server and you will >> find it very hard to find a shared host for this. Reason is that with >> PHP5.2 mssql support was apparently dropped and I couldn't get sybase >> support to run with SQL Server 2008 or later. >> >> I ended up using the official MS ODBC driver for Linux (supposedly only >> available for Redhat) and changed the install script around. Here is my >> Wiki page for the setup. Let me know if you need to know more: >> >> Cheers, >> >> Jochen >> >> Install Microsoft Native Driver on Linux >> >> (Adapted and fixed for Ubuntu from Strangenut SQL Server >> Blog<http://strangenut.com/blogs/dacrowlah/archive/2012/04/13/installing-and-using-the-microsoft-sql-server-odbc-driver-for-linux.aspx> >> - >> tested with PHP 5.3.10 on Ubuntu 12.04 ) >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=2> >> ]Make folder >> >> such as >> >> >> mkdir ~/asql >> cd ~/asql >> >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=3> >> ]Download native driver >> >> wget >> http://download.microsoft.com/download/6/A/B/6AB27E13-46AE-4CE9-AFFD-406367CADC1D/Linux6/sqlncli-11.0.1790.0.tar.gz >> tar xzvf sqlncli-11.0.1790.0.tar.gz >> >> We also have a local copy here: >> >> >> http://files.automatem.co.nz/shared/sqlserver/sqlncli-11.0.1790.0.tar.gz >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=4> >> ]Fix shell scripts >> >> 1. Scripts are started using /bin/sh, but this doesn't work on >> Ubuntu, change first line in both scripts to #!/bin/bash >> 2. install.sh is looking for libraries installed with rpm: glibc >> e2fsprogs krb5-libs openssl. This needs to be changed over to a Ubuntu >> version (currently figuring out >> how<http://stackoverflow.com/questions/15056762/change-install-script-from-redhat-to-ubuntu>), >> but in the meantime, change line 233 to >> >> local present="test"#$(rpm -q -a $lib) >> $log_file 2>&1 >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=5> >> ]download, build driver manager >> >> I'm not sure if this is necessary, because you may have already installed >> unixODBC-2.3.0, anyway... >> >> cd sqlncli-11.0.1790.0 >> ./build_dm.sh >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=6> >> ]install unixODBC >> >> the script wants to install unixODBC into /usr/lib64, which doesn't exist >> on ubuntu 12.04, make this directory >> >> sudo mkdir /usr/lib64 >> >> It will also have output a temp location, copy and paste this here: >> >> >> sudo sh -c "cd /tmp/unixODBC.27894.2997.17210/unixODBC-2.3.0; make install" >> #(actual folder as per your output) >> >> >> Note that depending on what was installed before, it could also be >> installed in another folder. Check the contents on /etc/odbcinst.ini on >> where the library is installed >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=7> >> ]install driver >> >> cd ~/asql/sqlncli-11.0.1790.0 >> sudo ./install.sh install --lib-dir=/usr/local/lib64 --accept-license >> >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=8> >> ](apparently optional) Set up DSN >> >> The instructions for ODBC use normally call for setting up a DSN in >> /etc/odbc.ini >> >> [LocalFreshco] >> Driver=SQL Server Native Client 11.0 >> Description=ODBC Database Connection >> Trace=Yes >> Server=192.168.10.157 >> Port=1433 >> Database=ExportInformationSystem >> >> however, because the PDO line contains all details >> >> >> odbc:Driver=SQL Server Native Client >> 11.0;Server=192.168.10.157;Port=1433;Database=SF_FRESHCO;UID=sa;PWD=xxxxxxxxxxxx;VarMaxAsLong=Yes >> >> It doesn't appear to be necessary. It allows however to set TDS version >> and other parameters >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=9> >> ]fix library links >> >> If PDO is used it will likely throw an error such as >> >> >> cannot open /usr/lib64/sqlncli-11.0.1790.0: no such file >> >> even if the file is exactly there. This is likely because of unmatches >> library dependencies You can find the dependencies with >> >> ldd /usr/local/lib64/sqlncli-11.0.1790.0 >> >> look for "not found" lines >> >> On Ubuntu 12.04 both libssl.so.10 and libcrypto.so.10 were not satisfied, >> this is because the version numbering is different on Redhat >> >> You can fix this with >> >> sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 >> /lib/x86_64-linux-gnu/libssl.so.10 >> sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.0.9.8 >> /lib/x86_64-linux-gnu/libcrypto.so.10 >> >> If this doesn't work, check where else 64bit versions of libssl and >> libcrypto may be and try to link up different version numbers. >> >> [edit<https://mediawiki.automatem.co.nz/index.php?title=MSSQL&action=edit§ion=10> >> ]command line test >> >> sqlcmd -U sa -P kto0202563200 -D -S Microsoft -d ExportInformationSystem -q >> "select * from DocumentType" -Y 30 >> >> which includes options >> >> >> -U username >> -P password >> -S Name of Server or name of DSN in /etc/odbc.ini >> -D specifies -S is ODBC DSN >> -d is database >> -q is query >> -Y output in 30 chars wide per column >> >> >> >> On 11 April 2014 13:14, Harvey Kane <[email protected]> wrote: >> >>> >>> Hi Everyone, >>> >>> I have a PHP website that needs to connect to a SQL Server database (as >>> well as a MySQL database). These extensions aren't supported in a default >>> PHP install and since this is new to me I'd prefer to use a server that's >>> already setup for it rather than risk breaking something on our server >>> config. >>> >>> Can anyone recommend a shared host which has the Microsoft SQL PHP >>> functions enabled or able to be enabled? Preferably NZ based, prefer LAMP >>> but if it has to be Windows then we could probably live with that. >>> >>> For the most part this is a standard Wordpress site on a MySQL database, >>> but we have a bit of custom functionality that needs to connect to a 3rd >>> party database. >>> >>> Thanks. >>> >>> -- >>> Harvey Kane >>> >>> Phone: >>> - Auckland: +64 9 950 4133 >>> - Wanaka: +64 3 746 8133 >>> - Mobile: +64 21 811 951 >>> >>> Email: [email protected] >>> If you need to contact me urgently, please read here >>> http://urgent.harveykane.com >>> >>> >>> -- >>> -- >>> NZ PHP Users Group: http://groups.google.com/group/nzphpug >>> To post, send email to [email protected] >>> To unsubscribe, send email to >>> [email protected] >>> --- You received this message because you are subscribed to the Google >>> Groups "NZ PHP Users Group" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Kind Regards, >> >> Jochen Daum >> >> "There is no shortcut to anywhere worth going" - Beverly Sills >> >> Automatem Ltd >> Tauranga: +64 7 281 1289 >> Auckland: +64 9 630 3425 >> Mobile: +64 21 567 853 >> Email: [email protected] >> Website: www.automatem.co.nz >> Skype: jochendaum >> http://nz.linkedin.com/in/automatem >> http://twitter.com/automatem >> > > > > -- > Kind Regards, > > Jochen Daum > > "There is no shortcut to anywhere worth going" - Beverly Sills > > Automatem Ltd > Tauranga: +64 7 281 1289 > Auckland: +64 9 630 3425 > Mobile: +64 21 567 853 > Email: [email protected] > Website: www.automatem.co.nz > Skype: jochendaum > http://nz.linkedin.com/in/automatem > http://twitter.com/automatem > > -- > -- > NZ PHP Users Group: http://groups.google.com/group/nzphpug > To post, send email to [email protected] > To unsubscribe, send email to > [email protected] > --- > You received this message because you are subscribed to the Google Groups > "NZ PHP Users Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] --- You received this message because you are subscribed to the Google Groups "NZ PHP Users Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
