I am trying to connect to sql server 2008 in windows authentication mode (w/o username and password) by using $connect=mssql_connect('username\SQLEXPRESS')
But it is giving me a fatal error Fatal error: Call to undefined function mssql_connect()
What should I give in the place of username and password when I am logging into the sql server express using windows authentication mode?(I am using sql server management studio)
Note: I have changed mssql.secure_connection = On on php.ini file
1 Answer
It sounds as if your copy of PHP doesn't have the MS SQL module built into it.
If you're running PHP 5.3 on Windows, this is because the MS SQL module is no longer available from PHP 5.3 and upwards. See the PHP manual for confirmation of this: http://www.php.net/manual/en/mssql.requirements.php
The same manual page also gives details of an alternative driver provided by Microsoft, which you can download and install (assuming you have permissions to install stuff on your web server of course).
If you're running a Linux-based PHP installation or PHP 5.2 or earlier on Windows, your problem is still that the MS SQL module hasn't been installed into your copy of PHP, but it should be possible to get it installed and working.
2 Comments
phpinfo() function in a test program; it will show you what modules are installed. If the MS SQL module is not there, you'll need to add it to your install. In Windows, use the PHP installer, and select the appropriate module from the list available during installation/update.