I have already Docker and SqlServer which is works normally. Now i want to connect to sql server with php. it gives me could not find driver error. I use php 8 on centos 7. How can i fix it?
Related
Using Ubuntu 16.10
I have been using external Mysql server just fine, but today I did an apt update and apt upgrade, after that. PHP simply won't connect to external mysql server anymore. I can connect the server via command line using mysql though, but php just does not. I tried simple script to open to connection and
mysqli_connect_error(); just gives out an error "connection refused"
Ports are open. Any idea why this suddenly happened after an update?
EDIT: Updated the client server. The server where external mysql is running works fine, I can connect to it from other servers. But one client server where php script runs can't access it after an update.
Found it. php 7 does not support ip:port anymore, but port has to be set up separately. Changed the default port via: ini_set('mysqli.default_port', 'port'); in the file where connection was made as I was unable to change it in the script I am using.
I have problem with connection to Vertica database from PHP code.
The situation is this:
I'm working on Windows 7,
I installed ODBC driver for Vertica, set it up and test connection was successful,
Vertica is running on virtual machine in VirtualBox, I can connect to it via ssh dbadmin#192.168.56.102.
I have tried all possibilities I've found but nothing worked. PDO cannot find server, odbc_connect is saying no driver exists.
Has anybody have idea please?
Thanks you very much.
J.
I am using Php to connect the SQL server using these code:
$dbhandle = mssql_connect($server,$username,$password);
or die("Could not connect to SQL server");
$selected = mssql_select_db($database,$dbcon)
or die("Could not open database $database");
However, I found that the code does not run. No error message and cannot do any mssql_query() with this.
After some research, I found that mssql is not default supported by Php 5.5 like mysql. However, I do not find the sulotion.
I found this from Microsoft but they are for Php on Windows. I cannot find the one for Linux
http://www.microsoft.com/en-us/download/details.aspx?id=20098
What should I do to install the SQL driver for PHP 5.5 in Ubuntu.
My Server
PHP 5.5.9 on Ubuntu
SQL server 2012 on Microsoft server 2012R2
Below is the reference for connecting to a MSSQL Server database wtih LAMP.
Microsoft-SQL-Server-Database
Ubuntu Server – Connect to MSSQL via PHP
Its work on my PC.
I have used default MS SQL driver to connect to a SQL server in a php application.
I'm using XAMPP 1.6.8. my php version is 5.2.6.
Application was connected successfully to the SQL server and the application was running successfully for a long time. Now suddenly the application is showing an error on mssql_connect() function with same MS SQL access information.
the error is "Unable to connect to server: xxx.xxx.xxx.xxx"
I also checked the SQL server access info with a SQL client. SQL client can connect successfully, therefore i think the access info is correct.
Can any one help me resolved this issue?
Thx
I just found my solution here. http://jimmyli.net/2009/03/php-unable-to-connect-to-mssql/ .problem was that the file ntwdblib.dll packaged with PHP5 was an old version. then i just replace with updated one from here http://jimmyli.net/wp/wp-content/uploads/2009/03/ntwdblib.zip
Thx
Does anyone know why mssql_connect would be slow? PHP is running on a Linux server with FreeTDS. I am trying to connect to a remote database. When I connect from PHP it takes about 3 seconds, but if I use the FreeTDS tsql command from the shell it connects in under a second, so it is able to connect faster. Is there a setting I can change or a different driver I should use?
You should start using PDO with MSSQL driver support.
More info on:
http://php.net/manual/en/ref.pdo-dblib.php
And some examples:
Connecting to mssql using pdo through php and linux