Search code examples
phpubuntusybasesqlanywhere

Connect to a remote Windows Sybase database from Ubuntu via PHP


Ubuntu 12.04 LTS Precise

I'm trying to use PHP to connect to a remote Windows Sybase database. Let us assume Windows 7 Enterprise SP1. I'm currently doing this in PHP:

$db = sybase_connect("10.1.208.111", "$user", "$pass");

And I'm getting an error of:

Warning: sybase_connect(): Unable to connect to server: 10.1.208.111

I understand that the server I'm connecting to (10.1.208.111), needs to be in the interfaces file. I'm trying to figure out where that is, or even if I have one on the Ubuntu server (I'm still new to linux itself). I read that the path for the file is located in the SYBASE environmental variable. I don't know where that is either. Can anyone shed some light? I can offer more information if you need it, I just don't know what you need right off the bat.

PS: The windows machine has Micros RES installed on it. That's the database I'm trying to pull data from. Not sure if that matters.


Solution

  • The default installation directory for Sybase ASE in windows is C:\sybase, so your interfaces (interfaces.ini) should be located there.

    For SQL Anywhere, the interfaces file is called SQL.ini, and it's location varies, but you should be able to do a search of your system drive to find it.

    For SQL Anywhere you probably want to use the PHP apis that are provide by SAP Sybase. The SQL Anywhere documentation is a pretty good place to start, as it covers all the pieces that need to be installed to get SQL Anywhere to talk to PHP.

    SQL Anywhere 11: SQL Anwhere PHP API

    You may also be able to find good information over at the SAP Community Network site for SQL Anywhere.