[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 692
  • Last Modified:

How can I connect to Sage from PHP in Linux?

Sage Version is SageLine50v10
0
skmanji
Asked:
skmanji
  • 4
  • 3
1 Solution
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
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
0
 
skmanjiAuthor Commented:
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 :(
0
 
Richard QuadlingSenior Software DeverloperCommented:
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Richard QuadlingSenior Software DeverloperCommented:
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.
0
 
skmanjiAuthor Commented:
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.
0
 
Richard QuadlingSenior Software DeverloperCommented:
Ah. Are you intending to write data back? I must admit, I never really played with their ODBC route as I believe it to be read-only. But that was a LONG time ago.

If you have SageCover (or whatever it is now called), then maybe it is worth seeing if they have unixodbc compliant drivers. I doubt it.

Using a proxy is probably the only way to do it.

Or you could go IIS and PHP which is well supported now. I'm running 3 IIS7+FastCGI+PHP5.3 servers here quite happily. We have an old Retrieve 4GL app (now well over 12 years old and still going), but I convert the data to MS SQL (over 7.5 million rows - 2.5GB) nightly.

Now there's a thought.

If you have a tool to extract ALL the data to an SQL DB (mySQL for example) - even using PHP on the Sage PC side (no webserver, just straight PHP scripts), then you could quickly sync the data.

0
 
skmanjiAuthor Commented:
"...quickly sync the data." Good idea. Thx.
0
 
skmanjiAuthor Commented:
The solution wasnt what I wanted ideally - but a reasonable compromise. It seems what I want isnt available.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now