參考
http://mickey-tang.blogspot.com/2018/05/php72sybase.html
環境:
Ubuntu 18.04
PHP 7.2
Apache 2.4
安裝好Apache php 後,另需要安裝php-sybase,此時會自動安裝FreeTDS
sudo apt-get install -y php7.2-sybase
增加FreeTDS 設定值
sudo nano /etc/freetds/freetds.conf
[sybase_db] host = db.com.tw port = 5000 tds version = 5.0
利用PDO測試連線(PHP Code)
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $user = 'dba'; $pwd = 'pwd'; $db_host = "sybase_db";//freetds name $db_select = ""; $dbconnect = "dblib:host=sybase_db;dbname=".$db_select; $pdo_sybase = new PDO($dbconnect, $user, $pwd); $sql = "select * from users where 1=1"; $res = $pdo_sybase->query($sql); while ($row = $res->fetch()){ echo $row['id'].'<br/>'; } ?>