Current location: Hot Scripts Forums » Programming Languages » PHP » Blank Page From Directory


Blank Page From Directory

Reply
  #1 (permalink)  
Old 06-30-06, 06:42 AM
Vyrus Vyrus is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Blank Page From Directory Listing Script

How come this piece of code will list the files and folders fine when using:

PHP Code:

<?php

if ($handle opendir('[b]/var/www/vhosts/example.com/subdomains/username/httpdocs/[/b]')) {
   while (
false !== ($file readdir($handle))) {
       if (
$file != "." && $file != "..") {
           echo 
"$file\n";
       }
   }
   
closedir($handle);
}
?>

But when this piece is run, all I get is a blank white page with no listings of the files and folders:

PHP Code:

<?php

if ($handle opendir('[b]/var/www/vhosts/niroxide.com/subdomains/username/[/b]')) {
   while (
false !== ($file readdir($handle))) {
       if (
$file != "." && $file != "..") {
           echo 
"$file\n";
       }
   }
   
closedir($handle);
}
?>

The difference between the two codes is the folder path, one is inside the httpdoc and the other one is one folder back.


I have full root access to the server to make any changes. Any advice and help to fix this problem will be appreciated.

Last edited by Vyrus; 06-30-06 at 06:58 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-30-06, 07:01 AM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Are you sure your root, for each username, is in /var/www ... Some are in other directories...
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-30-06, 12:38 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
From the PHP manual -
Quote:
If path is not a valid directory or the directory can not be opened due to permission restrictions or filesystem errors, opendir() returns FALSE
Even though you might have permissions to all the folders, the user/account that PHP/web server is running under might not.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-30-06, 03:29 PM
Vyrus Vyrus is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mab
From the PHP manual - Even though you might have permissions to all the folders, the user/account that PHP/web server is running under might not.
I think this is the problem, but the whole example.com folder is owned by the same user/FTP account. I have root access to make changes, but not on root when running the scripts.

So I guess the question is, what changes should I make to allow the scripts the proper premissions to access that folder?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 06-30-06, 05:30 PM
Vyrus Vyrus is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Well, since it's alittle late now to edit my previous post, I'd like to add:

Currently Running on the server is:

Fedora OS
Plesk Control Panel
PHP5
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 03:22 AM
Links on each sites page not in directory PolarBear Script Requests 1 01-10-05 07:51 PM
base64_decode an image, works on blank page, not on page where text is.. Acecool PHP 2 08-09-04 02:16 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 07:02 AM
Classified Ads skipper23 Perl 2 12-30-03 04:43 AM


All times are GMT -5. The time now is 12:12 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.