note 113666 added to ref.mssql
| From: | amolkulkarni82 at gmail dot com | Date: | Wed, 13 Nov 2013 07:31:20 +0000 |
| Subject: | note 113666 added to ref.mssql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197505@lists.php.net to get a copy of this message | ||
Here is the changes required to connect MSSQL database using mssql_connect with long password (more
than 30 chars)
Steps to follow:
1) cd /usr/local/src/freetds-0.91/
2) Change the values as required in freetds src:
# Default values:
# Filename: include/sybdb.h (line 67)
#define DBMAXNAME 30
# Filename: include/tds.h (line 760)
#define TDS_MAX_DYNID_LEN 30
# Filename: include/tds.h (line 831)
#define TDS_MAX_LOGIN_STR_SZ 30
3) Modify the TDS_MAX_LOGIN_STR_SZ macro to overcome the password limitation of 30 chars
4) Recompile the freetds
make clean && ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib
--enable-dbmfix --with-gnu-ld && make && make install
5) Restart the apache
/usr/local/apache2/bin/apachectl stop && /usr/local/apache2/bin/apachectl start
6) Export the FREETDS
export FREETDSCONF=/etc/freetds.conf
Test the MSSQLdatabase connection using CLI
> php -a
Interactive mode enabled
<?php
$conn = mssql_connect('hostname','username','password');
var_dump($conn);
if (!$conn)
echo $strerr = "ERROR: Failed to connect to MSSQL Server ('hostname') :
".mssql_get_last_message();
?>
CTR+D
expected output:
resource(1) of type (mssql link)
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/ref.mssql.php
Edit -- https://master.php.net/note/edit/113666
Del: integrated -- https://master.php.net/note/delete/113666/integrated
Del: useless -- https://master.php.net/note/delete/113666/useless
Del: bad code -- https://master.php.net/note/delete/113666/bad+code
Del: spam -- https://master.php.net/note/delete/113666/spam
Del: non-english -- https://master.php.net/note/delete/113666/non-english
Del: in docs -- https://master.php.net/note/delete/113666/in+docs
Del: other reasons-- https://master.php.net/note/delete/113666
Reject -- https://master.php.net/note/reject/113666
Search -- https://master.php.net/manage/user-notes.php