Advertisement

12.02.2004 at 08:02PM PST, ID: 21228707
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

opendir() problems with Windows?

Asked by TunaMaxx in PHP Scripting Language

Tags: , ,

Hello,

  This question is somewhat related to another I asked a while back:

"Convert flat log files to mySQL database"
http://www.experts-exchange.com/Web/Web_Languages/PHP/PHP_Databases/Q_21097456.html

  The solution worked very well, and I have been using it sinces then. However, now I would like to automate the process a more. Instead of having the individual log files 'pushed' to the server from which the script is run, I'd like the server to be able to go pull the details.

- The server is Win2K/Apache/MySQL/PHP and the client is Win2K.
- The client share and security are both set to 'Everyone' for the dir and files.
- Both machines are on an intranet and I have full administrative access.

  So far, I have had some success with:

$dp = opendir('./');

while ($item = readdir ($dp)) {
      if (eregi(".log$", $item)) {
            $log = file($item);
            for ( $i = 0; $i < count($log); $i++ ) {
            ...etc.

  Everything runs as expected as long as $dp is set to the same dir that the script is in. After that, it's a bit odd.

  Regardless of what I put for $dp (locally: '../', 'path/to/file' or to the client: '//servername/sharename', '\\\\severname\\sharename' etc.) PHP throws a warning but I can get a list of the files:

example:

Warning: file(.): failed to open stream: Permission denied in c:\path\to\file.php on line 20
----->Log filename: .
Warning: file(..): failed to open stream: Permission denied in c:\path\to\file.php on line 20
----->Log filename: ..
Warning: file(2004.11.26.log): failed to open stream: No such file or directory in c:\path\to\file.php on line 20
----->Log filename: 2004.11.26.log
Warning: file(2004.11.25.log): failed to open stream: No such file or directory in c:\path\to\file.php on line 20
----->Log filename: 2004.11.25.log
Warning: file(2004.11.24.log): failed to open stream: No such file or directory in c:\path\to\file.php on line 20
----->Log filename: 2004.11.25.log

  The '---->' indicates the part of the script that prints out what is happening with the file (logged, skipped, etc.) The result for '.' and '..' I can understand, but the rest are stumping me. It looks like the script has no trouble reading the contents of the share, so where is the problem?

  As I write this, I begin to wonder if this has anything to do with accessing the share at all. Maybe the fact that the script won't deal with files outside of it's directory is the root of the issue.

  Any ideas?Start Free Trial
 
Loading Advertisement...
 
[+][-]12.03.2004 at 02:03AM PST, ID: 12734223

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.03.2004 at 03:01AM PST, ID: 12734593

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: opendir, windows, php
Sign Up Now!
Solution Provided By: Bobbi_NGEmu
Participating Experts: 1
Solution Grade: A
 
 
[+][-]12.03.2004 at 09:36AM PST, ID: 12738238

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.03.2004 at 09:48AM PST, ID: 12738383

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.03.2004 at 11:02AM PST, ID: 12739068

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32