Jump to content

PHP Can't find file in subdirectory


carlg

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
Link to comment
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

Link to comment
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.
Link to comment
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

Link to comment
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




Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.