opendir issue

Problems with the Windows version of XAMPP, questions, comments, and anything related.

opendir issue

Postby ElfN » 30. December 2010 16:54

I've got a short script that produces a clickable list of htm files. Works perfectly online, doesn't work in xampp

Code: Select all
   if (!isset($_SESSION['last_page'])) {
      $path = "$DOCUMENT_ROOT/"; // this works in xampp
      //$path= "$DOCUMENT_ROOT/Colonix"; //this is what works online but produces errors in xampp
      //if I echo path I get e:\xampp\htdocs\ElfNori\Colonix
      $dir = opendir($path);  // if I echo $dir it gives me a Resource id #5
      // if I treat $path as an array and print_r it I STILL get Resource id #5
      while ($file = readdir($dir)) {
         if ($fname[1] == 'htm') {

There are actually a couple issues here. The first; online the path is $DOCUMENT_ROOT/Colonix. That doesn't work with my local xampp install. The local installation of Apache reads my document root as already including the Colonix directory. That means I can't use the same script local for testing that I will be moving online for the live site.

The second issue is opendir. I don't understand what it's doing. Look at the coding to see the result I'm getting. I'm baffled.

Posts: 19
Joined: 06. May 2009 20:14

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 40 guests