PDO Access when not Local

06/26/2018 23:12 mindlessx#1
Hey I'm trying to setup a simple Website to create Accounts on my Server, but i can't connect to database.

Code:
$conn = new PDO("sqlsrv:server=$host;database=$acc;ConnectionPooling=0",$user,$pass);
$host="XXXXXXX\SQLEXPRESS"
But what if its not local? is there sth like "ip:XXXXXXX\SQLEXPRESS"
06/27/2018 06:38 NorseGodTyr#2
Quote:
Originally Posted by mindlessx View Post
Hey I'm trying to setup a simple Website to create Accounts on my Server, but i can't connect to database.

Code:
$conn = new PDO("sqlsrv:server=$host;database=$acc;ConnectionPooling=0",$user,$pass);
$host="XXXXXXX\SQLEXPRESS"
But what if its not local? is there sth like "ip:XXXXXXX\SQLEXPRESS"
example
$host = "VALTYR-PC\SQLEXPRESS"; //SQL Host name
$user = "sa"; //SQL server username
$password = "YouTubeValtyr"; //SQL Server password
$dbs = array(
'ACC'=>"SRO_VT_ACCOUNT",
'SHARD'=>"SRO_VT_SHARD",
'LOG'=>"SRO_VT_SHARDLOG",
'WEB'=>"SRO_VT_VALTYR"); //Databases

Quote:
Originally Posted by mindlessx View Post
But what if its not local? is there sth like "ip:XXXXXXX\SQLEXPRESS"
yes you can add via IP

open the port in SQL Server Configuration Manager
Click down SQL Server Network Configuration
click on Protocols for SQLEXPRESS and than Enable TCP/IP
after this double klick left and IP Addresses
Scroll down IPAll add in TCP Dynamic Port 1443
and done
Dont forget Restart SQL Server
and done

if you want to add via via sql host use your ip with port 1443 dont forget after your IP ,1443

example $host="127.0.0.1,1443"
06/27/2018 17:40 mindlessx#3
Quote:
Originally Posted by mialuisa View Post
example
$host = "VALTYR-PC\SQLEXPRESS"; //SQL Host name
$user = "sa"; //SQL server username
$password = "YouTubeValtyr"; //SQL Server password
$dbs = array(
'ACC'=>"SRO_VT_ACCOUNT",
'SHARD'=>"SRO_VT_SHARD",
'LOG'=>"SRO_VT_SHARDLOG",
'WEB'=>"SRO_VT_VALTYR"); //Databases



yes you can add via IP

open the port in SQL Server Configuration Manager
Click down SQL Server Network Configuration
click on Protocols for SQLEXPRESS and than Enable TCP/IP
after this double klick left and IP Addresses
Scroll down IPAll add in TCP Dynamic Port 1443
and done
Dont forget Restart SQL Server
and done

if you want to add via via sql host use your ip with port 1443 dont forget after your IP ,1443

example $host="127.0.0.1,1443"
I did exactly what you said, but i still can't connect. :confused:
Already did this a few days ago.

THC/IP at Protocols for SQLEXPRESS is already activated. Used another port for dynamic, but changed it to 1443 too.

Is there maybe another solution?
Thanks.

--------------------

Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /xxxxxxxxxxxxxxxxxxxxxxx/sql.php:13 Stack trace: #0

#push

Port is open (checked) ✓
SQL Server is Running ✓
Password & Username are right ✓

Don't know what to do..
Thats the full connecting code (PDO)..

PHP Code:
<?php
$dbhost
="XX.XXX.XX.XXX,1443";
$dbname="SRO_VT_ACCOUNT";
$dbusername="sa";
$dbpassword="XXXXXXXXXXXXXXXX";


$link = new PDO("mysql:host=$dbhost;dbname=$dbname"$dbusername$dbpassword);
$statement $link->prepare("INSERT INTO dbo.TB_User(StrUserID, password, sec_primary, sec_content)
    VALUES(:name, :pass, :sec_p, :sec_c)"
);
$statement->execute(array(
    
"name" => "testname",
    
"pass" => "e22a63fb76874c99488435f26b117e37",
    
"sec_p" =>  3,
    
"sec_c" =>  3
));

?>
I always get error code 500 and don't know what to do.. the SQL Port shall be open ([Only registered and activated users can see links. Click Here To Register...] Proofed)..
Please Help
06/28/2018 16:49 NorseGodTyr#4
Quote:
Originally Posted by mindlessx View Post
I did exactly what you said, but i still can't connect. :confused:
Already did this a few days ago.

THC/IP at Protocols for SQLEXPRESS is already activated. Used another port for dynamic, but changed it to 1443 too.

Is there maybe another solution?
Thanks.

--------------------

Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /xxxxxxxxxxxxxxxxxxxxxxx/sql.php:13 Stack trace: #0

#push

Port is open (checked) ✓
SQL Server is Running ✓
Password & Username are right ✓

Don't know what to do..
Thats the full connecting code (PDO)..

PHP Code:
<?php
$dbhost
="XX.XXX.XX.XXX,1443";
$dbname="SRO_VT_ACCOUNT";
$dbusername="sa";
$dbpassword="XXXXXXXXXXXXXXXX";


$link = new PDO("mysql:host=$dbhost;dbname=$dbname"$dbusername$dbpassword);
$statement $link->prepare("INSERT INTO dbo.TB_User(StrUserID, password, sec_primary, sec_content)
    VALUES(:name, :pass, :sec_p, :sec_c)"
);
$statement->execute(array(
    
"name" => "testname",
    
"pass" => "e22a63fb76874c99488435f26b117e37",
    
"sec_p" =>  3,
    
"sec_c" =>  3
));

?>
I always get error code 500 and don't know what to do.. the SQL Port shall be open ([Only registered and activated users can see links. Click Here To Register...] Proofed)..
Please Help
Quote:
$link = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbusername, $dbpassword);
you will connect to mysql ??

im connecting is via mssql also sqlsrv
Quote:
$this->connect = new PDO("sqlsrv:Server=$host;Database=$dbs[WEB]",$user,$password);
also i never see that any create silkroad database for mysql :D

also change mysql:host to sqlsrv:host
06/28/2018 22:12 mindlessx#5
Quote:
Originally Posted by mialuisa View Post
you will connect to mysql ??

im connecting is via mssql also sqlsrv

also i never see that any create silkroad database for mysql :D

also change mysql:host to sqlsrv:host

even when i pick the right format it cant connect..
Already tried many templates for Silkroad websites. I always get error 500

PHP Code:
<?php 

$cfg
['sql_host'] = "xxxxxxxxxxxxx,1443"
$cfg['sql_user'] = "sa"
$cfg['sql_pass'] = "xxxxxxxxxxxxx"
$cfg['sql_db'] = "SRO_VT_ACCOUNT"


$sqlLink mssql_connect($cfg[sql_host],$cfg[sql_user],$cfg[sql_pass]); 
    if(!
$sqlLink) die("MSSQL server is not accessable, why should we try to select database ?"); 
        else 
        { 
            
mssql_select_db($cfg[sql_db],$sqlLink); 
        } 
?>
06/28/2018 22:13 B1Q#6
don't use mssql it's been deprecated for the past 7 years
download wamp or some other webserver for development
install the sqlsrv extensions (download based on your php version 5.6+ advised)

pdo connection string
Code:
$sql = new PDO("sqlsrv:server=192.168.81.128,1433;database=SRO_VT_SHARD","sa","sqlpw");
06/28/2018 22:23 mindlessx#7
Quote:
Originally Posted by B1Q View Post
don't use mssql it's been deprecated for the past 7 years
Who the fuck cares? I started with sqlsrv, as you see. I't didn't worked. I read all treads within those who were 7 yeas old. Now im pretty sure, its not the way of connection, causing my troubles..

My first way of connection is 100% correct.. ;)

Quote:
Originally Posted by B1Q View Post
don't use mssql it's been deprecated for the past 7 years
download wamp or some other webserver for development
install the sqlsrv extensions (download based on your php version 5.6+ advised)

pdo connection string
Code:
$sql = new PDO("sqlsrv:server=192.168.81.128,1433;database=SRO_VT_SHARD","sa","sqlpw");
couldnt you just tell me, "you have to install sqlsrv extensions" A WEEK AGO?
06/28/2018 22:56 NorseGodTyr#8
Quote:
Originally Posted by mindlessx View Post
Who the fuck cares? I started with sqlsrv, as you see. I't didn't worked. I read all treads within those who were 7 yeas old. Now im pretty sure, its not the way of connection, causing my troubles..

My first way of connection is 100% correct.. ;)



couldnt you just tell me, "you have to install sqlsrv extensions" A WEEK AGO?
use zend is one of the best webserver install sqlsrv and setup your webpage :)
06/29/2018 00:29 B1Q#9
Quote:
Originally Posted by mindlessx View Post
couldnt you just tell me, "you have to install sqlsrv extensions" A WEEK AGO?
i don't like posting dms on public forum but here it is
[Only registered and activated users can see links. Click Here To Register...]
you never said you're having an error in your webpage :)
P.S. if you can't read an error message, i can't help you.