Not Sure if I'm Having Trouble with Apache or Simple PHP

Alles, was PHP betrifft, kann hier besprochen werden.

Not Sure if I'm Having Trouble with Apache or Simple PHP

Postby youradrenalinefix » 15. January 2013 10:40

Hi everyone,

This is my 2nd topic Ive wrote about here. The 1st was welcomed with lots of great help which I am very appreciative of and I thank you all very much. Now I've got another issue that is stumping me:

I'm a newbie and Im watching a series of PHP tutorials and working through each example on my localhost with the thanks going to xampp but I'm having trouble now. although please note: All other tutorials are working properly while using xampp.

For example: In this tutorial: http://thenewboston.org/watch.php?cat=11&number=82

I have done everything exactly as illustrated (see MY code below)

Code: Select all
<?php
//Tut 82 & 83 File Handling: Listing Files 
echo '<strong>Tut 82 & 83 File Handling: Listing Files</strong><br><br>';
$directory = 'testing';

if ($handle = opendir($directory.'/')){
   echo 'Looking Inside Directory \''.$directory.'\':<br>';
   while ($file = readdir($handle)){
      echo $file.'<br>';
   
   }
}

?>


The problem is that I have a folder called testing inside my alias folder(where all the other tutorials have been working) but now I get the following errors:

Warning: opendir(testing/,testing/): The system cannot find the file specified. (code: 2) in obscuredforsecurity/testing\tut82-83.php on line 6

Warning: opendir(testing/): failed to open dir: No such file or directory in obscuredforsecurity\testing\tut82-83.php on line 6
What baffles me is why is it saying: Warning: opendir(testing/,testing/): ?? I never specified testing/,testing/. Why it doesn't just say: Warning: opendir(testing/): is beyond me as I only specified the folder testing ONCE.

The thing is that I've checked and double checked my file paths and the works but nothing seems to work

If anyone wouldn't mind setting me straight here, I'd be most appreciative and I thank you all once again.
youradrenalinefix
 
Posts: 17
Joined: 03. January 2013 13:16
XAMPP Version: 5.6.3
Operating System: Windows Home XP

Re: Not Sure if I'm Having Trouble with Apache or Simple PHP

Postby youradrenalinefix » 15. January 2013 20:13

Anyone?

I even tried this code "live" on my site and it's not working. If anyone could spot what's wrong here I'd be most appreciative!!
youradrenalinefix
 
Posts: 17
Joined: 03. January 2013 13:16
XAMPP Version: 5.6.3
Operating System: Windows Home XP

Re: Not Sure if I'm Having Trouble with Apache or Simple PHP

Postby glitzi85 » 16. January 2013 08:56

Hi,

if i read the error message correct, the php file is at this place:
Code: Select all
obscuredforsecurity\testing\tut82-83.php

so this folder MUST exist:
Code: Select all
obscuredforsecurity\testing\testing\

You are referring to the folder testing inside the folder where your php file is.

mfg glitzi
User avatar
glitzi85
 
Posts: 1797
Joined: 05. March 2004 23:26
Location: Dahoim


Return to PHP

Who is online

Users browsing this forum: No registered users and 2 guests