I would appreciate it if someone could share a similar experience and/or solution to this problem.
I have this setup for the php dev environment
- Mac running apache2.4/php7.4/freetds1.4.26/php-pdo-dblib
- Parallel Desktop 20.2.2 running guest OS Windows 11 + dev db Sybase ASE 16
- Production db Sybase ASE 16 on a remote server
- test script db.php
<?php
try {
$db=empty($argv[1])?$_REQUEST['db']:$argv[1];
$dbh = new PDO('dblib:host='.$db, 'sa', 'password');
echo "Connected!";
} catch (PDOException $e) {
echo "Failed: " . $e->getMessage();
}
FreeTDS definition as
- TESTDB (connect to guest on Parallel Desktop)
- PRODDB (connect to live db on a remote server)
[TESTDB] # local parallel desktop
host = 10.211.55.2
port = 5000
tds version = 5.0
[PRODDB] # remote production db
host = 10.10.1.3
port = 5000
tds version = 5.0
Tests that I have done:
- php-cli using TESTDB:
php db.php TESTDB
=> Connected! - php-cli using PRODDB:
php db.php PRODDB
=> Connected! - browser using TESTDB:
HTTP://localhost/db.php?db=TESTDB
=>Failed: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (TESTDB) (severity 9)
- browser using PRODDB:
HTTP://localhost/db.php?db=PRODDB
=> Connected!