PHPOMY Posted February 21, 2019 Share Posted February 21, 2019 Windows 2012 R2 Web Farm IIs 8.5 PHP 7.2 I am trying to create a logon page using PHP create a database on my SQL 2014 server. Installed the PHP SQL Server Drivers for PHP 7.2 <?php // Server in the this format: <computer>\<instance name> or // <server>,<port> when using a non default port number $server = 'SQLC,1433'; // Connect to MSSQL $link = mssql_connect($server, 'phpuser', 'xxxxxxxxxxxxxx'); if (!$link) { die('Something went wrong while connecting to MSSQL'); } ?> I get an HTTP 500 internal server error cant get past this one Any thing else I can provide to help us fix this let me know Thank you Tom Quote Link to comment https://forums.phpfreaks.com/topic/308361-php-not-connecting-to-sql-server/ Share on other sites More sharing options...
benanamen Posted February 21, 2019 Share Posted February 21, 2019 (edited) mssql_connect was removed from Php http://php.net/manual/en/function.mssql-connect.php PDO is how you will want to do it.http://php.net/manual/en/book.pdo.php Edited February 21, 2019 by benanamen 1 Quote Link to comment https://forums.phpfreaks.com/topic/308361-php-not-connecting-to-sql-server/#findComment-1564656 Share on other sites More sharing options...
PHPOMY Posted February 21, 2019 Author Share Posted February 21, 2019 Benanamen Thank you for the fast response I saw that link yesterday and tried that code <?php // Server in the this format: <computer>\<instance name> or // <server>,<port> when using a non default port number $server = 'SQLC,1433'; // Connect to MSSQL $link = mssql_connect($server, 'phpuser', 'xxxxxxxxxxx'); if (!$link) { die('Something went wrong while connecting to MSSQL'); } ?> Named it testconnection.php HTTP 500 Internal Server Error. Any ideas? Thakn you Tom Quote Link to comment https://forums.phpfreaks.com/topic/308361-php-not-connecting-to-sql-server/#findComment-1564657 Share on other sites More sharing options...
PHPOMY Posted February 21, 2019 Author Share Posted February 21, 2019 Ok I see what you meant now. I need to convert my mssql_connect to use PDO I have not been able to find an example of the replacement for this? you have a example of using PDO to connect to a SQL Server Database? Quote Link to comment https://forums.phpfreaks.com/topic/308361-php-not-connecting-to-sql-server/#findComment-1564658 Share on other sites More sharing options...
PHPOMY Posted February 21, 2019 Author Share Posted February 21, 2019 Got it working now this can be marked as resolved Thank you Quote Link to comment https://forums.phpfreaks.com/topic/308361-php-not-connecting-to-sql-server/#findComment-1564659 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.