Zhixian's Tech Blog


Undefined function sqlsrv_connect()

One of the issues with using Microsoft Drivers 3.0 for PHP is it only works up to PHP version 5.4 while the latest stable version is 5.5.
Attempting to connect to a Sql Server database using the driver on a PHP 5.5 runtime will result in the following message.


Some workarounds would be:

  1. Use ODBC instead of Microsoft Drivers 3.0 for PHP.
  2. Downgrade the your PHP runtime from 5.5 to 5.4
  3. Get the source code for Microsoft Drivers 3.0 for PHP and compiled it for PHP 5.5 runtime.
  4. Get one of the re-compiled Microsoft Drivers 3.0 for PHP for PHP 5.5 that are distributed by others in the Internet.


Set MySql default collation to UTF8

Filed under: computing, database, web application development — Tags: , , , , , , — Zhixian @ 02:06:07 am

One of the bad thing about installing MySql using Ubuntu Software Center is that it does not allow you to select the default collation of MySql Server. This is one of the nice things you would find in the Windows version of MySql installer.

In any case, to set MySql collation to use UTF8, all you have to do is:

  1. Edit your MySql configuration file (typically found at /etc/mysql/my.cnf)
  2. Under the section [mysqld]add the following lines:
    # utf8
    init-connect=’SET NAMES utf8′
  3. Restart your MySql

Blog at WordPress.com.