Allows SilverStripe to run on a SQL Server 2008 or SQL Server 2008 R2 database.
Note: SQL Server 2008 R2 Express, a free version with some limitations is also compatible.
For the most part, connecting to a SQL Server database on Windows is easy. Make sure you have installed SQL Server Native Client on the website server if the database is hosted on another server, as well as the SQL Server Driver for PHP “sqlsrv”.
More information on setting up the Microsoft Platform for PHP is available.
Connecting to a SQL Server database on Linux or Mac OS X can be achieved using the third-party library FreeTDS.
The following assumes that you installed PHP using the default package manager of the operating system.
yum install php-mssql
Open /etc/freetds.conf with an editor, and find “tds version = 4.2”. Replace 4.2 with 8.0
apt-get install php5-mssql
Open /etc/freetds/freetds.conf with an editor, and find “tds version = 4.2”. Replace 4.2 with 8.0
port install php5-mssql
Open /opt/local/etc/freetds/freetds.conf with an editor, and find “tds version = 4.2”. Replace 4.2 with 8.0
These packages will install the mssql extension for PHP, as well as FreeTDS, which will let you connect to SQL Server from Linux and Mac OS X.
You have three options to install SQL Server 2008 support with SilverStripe.
The first option is to use the installer. This is the recommended option.
The second option is to setup SQL Server 2008 support manually. This can be achieved by following these instructions:
$databaseConfig = array( 'type' => 'MSSQLDatabase', 'server' => '[FreeTDS connection name OR Windows server name]', 'username' => 'sa', 'password' => 'mypassword', 'database' => 'SS_mysite' );
Finally, visit dev/build so that SilverStripe can build the database schema and default records.
Finally, the third option is to change your environment to point to MSSQLDatabase as a database class. Do this if you're currently using an _ss_environment.php file.
define('SS_DATABASE_CLASS', 'MSSQLDatabase');
Last steps:
By default, you can only access a MS SQL Server over named pipes. To enable TCP access, see the following:
SQL Server 2008 is not accessible on Windows without opening certain ports on Windows Firewall.
Only do this if you require other computers access to the database. If the local machine is the only one using the database, this is not required.
This page has information on configuring your firewall to allow remote access to SQL Server.
So far, we're using the built-in Fulltext Search functionality provided by SQL Server. It's not perfect, since it can only search on some data types, but it's a good start. Please see tutorial 4 for information how to enable fulltext search and the necessary controller hooks.
[myserver] host = myserver.mydomain.com port = 1433 tds version = 8.0
Then, you can use “myserver” as the server name when installing SilverStripe, so your port and tds version settings are applied.
If this doesn't work for you, you can try putting the tds version parameter in the global section:
[global] ... tds version = 8.0
Fedora Linux uses SELinux (Security Enhanced Linux) which could block httpd network traffic. Please check that this does not interfere with httpd being able to access SQL Server through the network.
Use tabs (not spaces) when editing the freetds.conf file!