Jump to content

Archived

This topic is now archived and is closed to further replies.

carlg

PHP Can't find file in subdirectory

Recommended Posts

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

Share this post


Link to post
Share on other sites
In your Apache config file - httpd.conf - Check the 'DirectoryIndex' is pointing to index.php as well as index.html

Share this post


Link to post
Share on other sites
[!--quoteo(post=374002:date=May 15 2006, 10:26 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ May 15 2006, 10:26 AM) [snapback]374002[/snapback][/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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[!--quoteo(post=374014:date=May 15 2006, 10:52 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 15 2006, 10:52 AM) [snapback]374014[/snapback][/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

Share this post


Link to post
Share on other sites
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




Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.