Solved

php connection string for OLE-DB and remote data server

Posted on 2009-04-02
5
1,493 Views
Last Modified: 2013-12-12
Hello,

Using PHP and trying to access Visual FoxPro DBC. We can get it to work when data is local, but production data is on another server and that fails.

We built the sting that fails on the box running PHP and when we use the Test Connection button in Data Link Proprties the test passes but when we insert it into PHP script it fails with:

 Warning: (null)(): Invoke() failed: Exception occurred. Source:
Microsoft OLE DB Provider for Visual FoxPro Description: Invalid path or file name. in d:\inetpub\wwwroot\dev\your_account\pending_orders\index.php on line 3

// This is the connection string that DOES NOT works.  Here the database is located on the file server.

//$conn = new COM("ADODB.Connection");

//$conn->Open('Provider=VFPOLEDB.1;Data Source=\\servername\foldername\pro74\PRODATA.DBC;Mode=ReadWrite|Share Deny None;Password="";Collating Sequence=MACHINE');
 

// This is the connection string that DOES works.  Here the database is located on the web server itself.

$conn = new COM("ADODB.Connection");

$conn->Open('Provider=VFPOLEDB.1;Data Source=d:\pro74\PRODATA.DBC;Mode=ReadWrite|Share Deny None;Password="";Collating Sequence=MACHINE');

Open in new window

0
Comment
Question by:BobBrink
  • 3
  • 2
5 Comments
 
LVL 25

Expert Comment

by:SStory
ID: 24054231
OK. Do you have the data providers installed on the webserver?

BTW a  great place for connection strings is:
http://connectionstrings.com/

Here's one for FoxPro:
http://connectionstrings.com/visual-foxpro

Also, I imagine that the web user doesn't have permission to that directory
0
 
LVL 25

Expert Comment

by:SStory
ID: 24054240
Since MS, I assume this is IIS and not Apache. Is that true?
If so on Windows, the IUSR_<machinename> user account will need permission to the folders you are referencing, or you will need a DSN.
0
 

Author Comment

by:BobBrink
ID: 24054511
Hello,

Yes it it IIS. I'll have the tech on site check IUSR_<machinename> user account permissions.

Thanks,

Bob
0
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 24054682
You are welcome, this is most likely the problem. You run under your credentials as a dev, but on the website it runs under this accounts credentials.  It is generally a security issue to allow that account outside of the c:\inetpub\wwwroot folder so by default it doesn't. Then one must use care when going outside of the defaults i.e. don't put anything in that other folder that you don't want them to get to.  Really they should only access the database itself, not the drivers...the system will do that.
0
 

Author Closing Comment

by:BobBrink
ID: 31565954
Thanks for the help!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now