Jump to content


Photo

PHP Can't find file in subdirectory


  • Please log in to reply
5 replies to this topic

#1 carlg

carlg
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts
  • LocationPA

Posted 15 May 2006 - 01:34 AM

If I place a file called index.php in my doc root, php finds the file and everything is fine.

I created a dir under doc root and placed a file there called index.php, and I get a blank screen in browser.

I rename the same file in the same dir to index.html and the browser displays the output.

Where should I look for problem?

Thanks


#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 15 May 2006 - 02:26 PM

In your Apache config file - httpd.conf - Check the 'DirectoryIndex' is pointing to index.php as well as index.html

#3 carlg

carlg
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts
  • LocationPA

Posted 15 May 2006 - 02:44 PM

[!--quoteo(post=374002:date=May 15 2006, 10:26 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ May 15 2006, 10:26 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
In your Apache config file - httpd.conf - Check the 'DirectoryIndex' is pointing to index.php as well as index.html
[/quote]


Even if I rename the file abc.php, it still doesn't work.
But if I name it abc.html, it will be OK

When I name it abc.php, it finds the file, it just displays a blank screen



#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 15 May 2006 - 02:52 PM

Are these subdirectory files on a live server, i.e. www.somedomain.com/somedir/abc.php or are you testing this locally. If locally, then you can only view .php files when navigating to localhost; you can't view .php simply by doubling-clicking a file name in Explorer (for example). php files need a server to parse them before being sent to the browser.
Legend has it that reading the manual never killed anyone.
My site

#5 carlg

carlg
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts
  • LocationPA

Posted 15 May 2006 - 04:24 PM

[!--quoteo(post=374014:date=May 15 2006, 10:52 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 15 2006, 10:52 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Are these subdirectory files on a live server, i.e. www.somedomain.com/somedir/abc.php or are you testing this locally. If locally, then you can only view .php files when navigating to localhost; you can't view .php simply by doubling-clicking a file name in Explorer (for example). php files need a server to parse them before being sent to the browser.
[/quote]


No, the PHP files are on a Fedora server and I'm on my XP machine.

If I place abc.php in $DOCROOT, it is fine

If I place it in $DOCROOT/admin/, it dispays a blank page



#6 carlg

carlg
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts
  • LocationPA

Posted 15 May 2006 - 08:03 PM

When I call up y.php in the browser, this displays an empty page

[myuser@localhost admin]$ pwd
/var/www/html/admin
[myuser@localhost admin]$ more y.php
<?
print "sdfdsfsdfsdfdsfsdfsd";
?>



In this example, the string gets displayed in the browser as you would expect

[myuser@localhost admin]$ cd ..
[myuser@localhost html]$ pwd
/var/www/html
[myuser@localhost html]$ more y.php
<?
print "sdfdsfsdfsdfdsfsdfsd";
?>
[myuser@localhost html]$



This also displays perfectly fine in browser


[myuser@localhost admin]$ more y.html
<HTML>
<H1 ALIGN="center">HELLO</H1>
</HTML>
[myuser@localhost admin]$pwd
/var/www/html/admin
[myuser@localhost admin]$





I just can't figure out what is going on









0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users