$ rpm -qa | grep php-mssqlThe output should look something like this:
php-mssql-5.3.8-4.el6.remi.x86_64Next check that freetds is installed.
$ rpm -qa | grep freetdsThe output should look something like this:
freetds-0.82-6.el6.x86_64You should now be able to connect to your MSSQL database directly from the command line. Make sure to replace the server, user and password with valid information.
$ /usr/bin/tsql -S [mssql.servername.or.ip] -U [ValidUser] locale is "en-US.UTF-8" locale charset is "UTF-8" Password: [password] 1>Enter "quit" to exit your successful connection. If the
tsql
command doesn't return the 1>
prompt, verify that you can get to your MSSQL server with the following command:
ssh [mssql.servername.or.ip] -p 1433Also verify that your username and password are valid.
At this point you can set your database configuration to connect to the database.
var $default = array( 'driver' => 'mssql', 'persistent' => false, 'host' => 'mssql.server.or.ip', 'login' => 'username', 'password' => 'password', 'database' => 'database', 'prefix' => '' );Through much trial and error I've discovered that if you connect directly to the server in this manner some commands, such as
mssql_bind, mssql_execute,
and mssql_init
don't work. Now you could setup and execute stored procedure commands through mssql_query
this isn't as secure.Instead, set up a freetds configuration for the server, connect with that instead, and the commands will now work fine.
Edit
/etc/freetds.conf
and add the following block:
[ServerIdentifier] host = [mssql.servername.or.ip] port = 1433 tds version = 8.0Then use the ServerIdentifier you chose instead of the server name or ip in the database configuration host variable and you're all set.
No comments:
Post a Comment