Link to home
Start Free TrialLog in
Avatar of skmanji
skmanji

asked on

How can I connect to Sage from PHP in Linux?

Sage Version is SageLine50v10
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Try creating a DSN First for your Sage server..
And then you can do something like the one below to connect

<?php
$database = "DSN";
if (!$db = @odbc_connect($database,"user","pass")) {
   echo "Could not connect to $database!\n";
   exit;
}
?>

More info here:

http://www.phpdig.net/ref/rn63re1309.html
Avatar of skmanji
skmanji

ASKER

Sage resides on a Windows PC - there is no Linux version of Sage. I want to connect from a Linux PC - so where do I put the IP of the windows PC?

What you are suggesting may work for a windows version of PHP which is on the same machine as the Sage. But thats not whats required :(
rrjegan17

Sage Line 50 is a peer-to-peer, windows based entry level accounting system. Not client/server. No centralized service. At the time (about 6 years ago), Line 100 was the same; peer-to-peer.



skmanji

Line 50 does have an import/export facility so you can produces CSV style files and import them into your linux box.

I used to develop an EPOS system which could interact with Sage Line 50 and Line 100. It was written in Sage's Retrieve 4GL. It was DOS based, but ran under the Sage's Line 100 Windows runtime quite happily.

I would NOT recommend talking directly to the Line 50 DB as it is not a normalised DB and you have to know WAY too much.

What data are you wanting to import/export.
The EPOS system would read Stock and Customer records and provide files for Stock transactions and Sales/Nominal transactions. It was just a case of running the imports and exports in the right sequence and all was well.
Avatar of skmanji

ASKER

We can already read from a Sage DB via ODBC drivers using Visual Foxpro (because the VFP App resides on the same PC as a Sage Installation.)

However we are moving away from VFP to browser based apps using PHP/Linux. But its not (yet) possible to wean Accounts from Sage - so we need to be able to access the Sage DB from our remote PHP Apps to get data for reporting purposes. Currently we have to use VFP Apps.

A solution would be to have a windows-based web server on the Sage PC and use that as a "bridge" so that any app can call the windows web server and that in turn will call the Sage via a local ODBC - but you can see its getting a bit convoluted. An ideal solution would be to access the Sage directly via ODBC from any remote location.
ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skmanji

ASKER

"...quickly sync the data." Good idea. Thx.
Avatar of skmanji

ASKER

The solution wasnt what I wanted ideally - but a reasonable compromise. It seems what I want isnt available.