Linux/PHP/SQL: Ubuntu/Php/Sybase: Connecting sysbase database with php7

PHOTO EMBED

Mon Aug 29 2022 16:21:54 GMT+0000 (UTC)

Saved by @marcopinero #php #sql

<?php

/*==========  install at ubuntu: ==============

sudo apt install php-sybase


//==================================

append this into /etc/freetds/freetds.conf:
(192.168.0.250:2638 is an example:)

//==================================

sudo nano /etc/freetds/freetds.conf

[connName]
    host = 192.168.0.250  
    port = 2638
    tds version = 7.4
    database = MYDB
    
//======  php: */

$connName = "connName";
$user = "myuser";
$pass = "mypass";

$st="dblib:host=$connName;charset=iso8859-1";
$conn = new PDO($st,$user,$pass);

/* $conn->prepare($sql_query);
...etc
*/
content_copyCOPY

Ubuntu/php7.0/sybase connection throughout freetds.