PHP 7 (Debian) connection error with Sybase 16

Asked

Viewed 197 times

1

I have the following difficulty: I need to configure the PHP environment to connect to a Sybase 16 base. I am not a PHP programmer and I am helping another colleague. Everything that has been tried so far does not work.

The code is:

$connection= new PDO ("dblib:version=4.2;charset=UTF-8;host=".$host.":".$port.";dbname=".$dbname, $username, $password);

and get the error:

SQLSTATE[01002] Adaptive Server connection failed (severity 9)

Is there a tutorial for this? Everything I find is either for PHP 5 or for Windows.

Some more information:

PHP Version 7.0.26-1~dotdeb+8.2
System Linux websrv01 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19) x86_64
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php/7.0/apache2
Loaded Configuration File /etc/php/7.0/apache2/php.ini

UPDATING:

Following the suggestions, we change the code this way:

$connection = new PDO("dblib:version=8;charset=UTF-8;host=".$host.":".$port.";dbname=".$dbname, $username, $password);

Which resulted in :

« SQLSTATE[] (null) (severity 0) »

Another attempt was to use:

$connection = new PDO("sybase:host=".$host.":".$port.";dbname=".$dbname, $username, $password);

that continues with the error:

« could not find driver »

The drivers have been installed, but I know that PHP requires a configuration in your INI that I am not able to do.

  • Have you tried modifying the driver version? Try a newer one: dblib:version=8.0

  • You state in the title that it is php7.2, but in the information this 7.0.26, something wrong is not right.

  • Tried to: sybase:host=".$host.":".$port.";dbname=".$dbname?

  • @Guilhermenascimentop. You are right. It was my colleague who told me it was 7.2. It really is 7. I will suggest that he make the recommended modifications here and come back to post the result.

  • @Guilhermenascimentop The use of the connectionstring Sybase:host=". $host.":". $port." ;dbname=". $dbname resulted in "could not find driver". Installing the Sybase driver (https://packages.debian.org/fr/sid/php7.0-sybase) may be wrong. That would be the problem?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.