Hi I have a big problem with php connection to my local database.
I'm running: Windows Server 2008 sp 1. SQL server 2012. My SQL server name: LRE-XP-VS2003\SQLEXPRESS. (status is running)
This is how I'm trying to connect
$server = 'localhost'; //or 127.0.0.1
$login = 'sa';
$passwd = 'my_passwd';
$database = 'ms4033';
$port = '49717';
$con = mysqli_connect ( $server , $login, $passwd, $database, $port );
if (!$con) {
die("Connection error: " . mysqli_connect_errno());
}
Result I get is spinning the loading button in browser and after long time "Internal Server Error - The FastCGI process exceeded configured activity timeout"
For the port number I checked in HKEY_LOCAL_MACHINE
and also directly in database
USE master
GO
XP_READERRORLOG 0, 1, N'Server is listening'
GO
and in SQL server Configuration manager too. Without port number I get "No connection could be made because the target machine actively refused it" or "Connection error: 2002"
I tried diseable my Firewall and it did not help.
I'm running asp .net too and paradoxically the connection is working properly with this:
<add key="connectionString" value="server=LRE-XP-VS2003\SQLEXPRESS;database=ms4033;packet size=4096;user id=sa;password=my_passw" />
Am I missing something?
And what's difference between $server = 'localhost';
or $server = 'LRE-XP-VS2003\SQLEXPRESS';
?
Thanks a lot.