Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

php connection string for OLE-DB and remote data server

Posted on 2009-04-02
5
Medium Priority
?
1,537 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

824 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