Solved

php connection string for OLE-DB and remote data server

Posted on 2009-04-02
5
1,497 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

773 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