Unable to connect SQL SERVER 2008 R2 - php

i have one page for register ... all my config is right but my register.php can't connect to my sql server..
Error
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: x.x.x.x in C:\xampp\htdocs\rfweb\regis.php on line 81
code in line 81 is
$connectsql=mssql_connect($db_host, $db_user, $db_pass) or die('<center><b>'.$lang_error_cant_connect1.'</b><br>'.$lang_error_cant_connect2.'<br><br>Back</center>');
spesification :
SQL SERVER 2008 R2 and xampp 1.6
i've try to setting ODBC, Restart SQL, ect
anyone help me to fix it?

Try sqlsrv queries instead of mssql, and make sure you properly configured the ports of your xampp. Another thing, try to check whether you have IIS, maybe it's blocking your xampp.

Related

Why can I not connect to my PostgreSQL database with PHP?

I have recently attempted to install a postgresql database on a digital ocean droplet running Ubuntu 18.04 x64
Using PgAdmin on my local PC, I can connect fine to the database.
Using my own C# tool on my local PC, I can connect fine to the database.
Using PHP on another server however, I cannot connect and upon checking the error log I have receiving this -
[19-Jan-2019 16:32:55 UTC] PHP Warning: pg_connect(): Unable to
connect to PostgreSQL server: could not connect to server: Connection
refused Is the server running on host "178.62.42.168" and
accepting TCP/IP connections on port 5432?
My PHP code is as follows, credentials adjusted for posting here but are correct.
<?php
$db = pg_connect("host=hostip port=5432 user=sam password=sensoredpassword dbname=sam ") or die('connection failed');
?>
Port 5432 is open.
I have adjusted /etc/postgresql/10/main/postgresql.conf >>> "listen_addresses = '*' and uncommented.
I have adjusted /etc/postgresql/10/main/pg_hba.conf and added >>> host all all 0.0.0.0/0 md5
Why can I not connect with PHP but I can connect with other tools and languages? Could something on the server the PHP is running on be blocking the connection?

Cannot connect to localhost MySQL - mysql.sock error - ERROR 2002 (HY000)

I'm using a brew php mysql config for my localhost and after trying to switch from php71 to php56, I am now unable to connect to my localhost and get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
My services running:
I am researching this for quite some time now and I can't seem to be able to fix it. Please can someone help me? I'm going crazy.

How can fix error PDOException: could not find driver?

I have local site in Wamp32, apache 2.4.23, php 7.0.10 and mysql 5.7.14
I wrote program to connect to sql server 2014 in another server but when I run this program it has an error
"could not find driver"
In php.ini I have:
extension=php_sqlsrv_7_ts.dll
extension=php_pdo_sqlsrv_7_ts.dll
My command for connect to sql server is:
$connection = new PDO('sqlsrv:Server=myserverIP;Database=mydatabase', 'username', 'password');
My server OS is windows server 2012R2

How to connect from cakePHP3 to MSSQL Server

(I develop on a Windows System with XAMPP and use cakePHP3)
I want to connect from my cakePHP3 Localhost application, to a external SQL Server (installed on a external Windows Server 2012 r2).
In my app.php I config my Server and that is how I test the connection:
try {
$connection = ConnectionManager::get('sqlServer');
$connected = $connection->connect();
}catch (Exception $connectionError) {
echo "not";
}
echo "connected";
On testing I get this error:
A Database connection using was missing or unable to connect.
The database server returned this error: SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver 11 for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712
So I go to my Server and Installed the needed extensions (ODBC Driver 11 for SQL Server). But I get still the same Error.
Is it possible to connect to the external Server from Localhost? Or did I make a mistake?

Failed to connect to: localhost:27017: Connection refused

I have installed MongoDB in xampp on Ubuntu using Laravel 5.1. But I always get this error
MongoConnectionException in TestController.php line 19: Failed to
connect to: localhost:27017: Connection refused
Nor I'm able
I have gone through a lot of questions, but all proved to be trivial solution.
Please help me with this as I'm stuck on it.
I think that first thing to do is to ssh on that server and check that mongod process is alive, then try open mongo shell using command - mongo . If all works try telnet on this server and port from your machine ,if there is no errors , read mongo logs

Categories