PHP7 - Connect to sybase database - php

http://php.net/manual/en/function.sybase-connect.php is removed as from PHP7.
So now I am gettings this error:
PHP Fatal error: Uncaught Error: Call to undefined function sybase_connect()
How am I supposed to connect to sybase now with PHP7?

You are using Ubuntu 16.04, so after installation of php7.0-sybase package in your system, you are able to connect with Sybase database using pdo_dblib
Example #1 PDO_DBLIB DSN examples
sybase:host=localhost;dbname=testdb
Following general PDO reference, you create connection like this
$databaseHandler = new PDO('sybase:host=localhost;dbname=testdb', $user, $pass);

Related

Connecting to Sybase database using Doctrine orm and php7

I am creating a web application in php 7.2 and need to connect to a Sybase database. I am using Doctrine orm.
I have tried using the sqlanywhere driver and the pdo_sqlsrv driver to connect to Sybase.
However with sqlanywhere I am getting the error:
Warning: sasql_pconnect(): SQLAnywhere: [-832] Connection error: Connection was dropped (may not be a SQL Anywhere server)
With pdo_sqlsrv I get the error:
PDOException: SQLSTATE[HY000]: [Microsoft][ODBC Driver 13 for SQL Server]Protocol error in TDS stream.
I have googled both these errors and have not been able to resolve either.
Does anyone have any suggestions for how to connect to Sybase using php7.2 and Doctrine orm?

A Database connection using "Mysql" was missing or unable to connect

My code is executing properly on development. But on production gives following error:
Missing Database Connection
Error: A Database connection using "Mysql" was missing or unable to connect.
The database server returned this error: Selected driver is not enabled
Error: Mysql driver is NOT enabled
Mysql extension on PHP 5.5.x and above is deprecated.
On PHP 7 mysql has been removed.
You should use PDO. If you can't, then try to replace your mysql with mysqli extension.
I got the same error, but it resolved with this
yum install --enablerepo=remi,remi-php70 php-mysqlnd

wamp php5.3.5 mssql_connect() Fatal error

I am using WampServer Version 2.2, php5.4.3 , Apeache2.2.22 I could not use mssql_connect(), "mssql_connect() Fatal error: Call to undefined function mssql_connect()" I went through googling but still not found solution.
It is always better to use PDO which supports ms sqlserver and other databases, you can use the syntax
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
or you can refer the documentation https://secure.php.net/manual/en/pdo.connections.php
You don't have the MS SQL Drivers installed. You can check this with phpinfo();
On Linux you need mssql.so or sybase.so With debian its apt-get install php5-sybase
For windows take a look here
Drivers need to be configured for PHP to find the function
mssql_...
You could also look at PDO DB classes as they can connect to any DBS, you need the drivers installed tho.

php_dblib enabled but not in phpinfo (Windows)

I need to connect to a remote Sybase database with PHP 5.4.5 and I therefore enable the driver php_dblib (FreeTDS) for PHP and it shows as is in Wampserver but when I look at the phpinfo() results, there is nothing about dblib.
My application (Zend) returns
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in ... PropelPDO->__construct('dblib:host=ans...', 'sa', '', Array)
I am running Wampserver 2.2, Apache 2.2.3 and PHP 5.4.5.
Thank you for your help.

How do I connect mssql with PDO using php 5.4.19

I am gettin following error when I connect to mssql
Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: This extension requires the Microsoft SQL Server 2012 Native Client ODBC Driver to communicate with SQL Server
And I am using
$db = new PDO("sqlsrv:server=127.0.0.1;database=test;", "sa", "mypassword");
I have also added driver in C:\xampp\php\ext and set that extension in php.ini file
[PHP_PDO_MSSQL]
extension=php_pdo_sqlsrv_54_ts.dll
I have tried several tutorials, what exactly I am doing, Please tell what I am doing wrong?
what version of the php pdo sqlsrv are you using?
Try updating it to v3.1
http://www.microsoft.com/en-us/download/details.aspx?id=20098
You might neet the ODBC driver as well:
http://www.microsoft.com/en-us/download/details.aspx?id=36434

Categories