carlg Posted May 15, 2006 Share Posted May 15, 2006 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 https://forums.phpfreaks.com/topic/9684-php-cant-find-file-in-subdirectory/ Share on other sites More sharing options...
zq29 Posted May 15, 2006 Share Posted May 15, 2006 In your Apache config file - httpd.conf - Check the 'DirectoryIndex' is pointing to index.php as well as index.html Link to comment https://forums.phpfreaks.com/topic/9684-php-cant-find-file-in-subdirectory/#findComment-35961 Share on other sites More sharing options...
carlg Posted May 15, 2006 Author Share Posted May 15, 2006 [!--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 OKWhen I name it abc.php, it finds the file, it just displays a blank screen Link to comment https://forums.phpfreaks.com/topic/9684-php-cant-find-file-in-subdirectory/#findComment-35969 Share on other sites More sharing options...
AndyB Posted May 15, 2006 Share Posted May 15, 2006 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 https://forums.phpfreaks.com/topic/9684-php-cant-find-file-in-subdirectory/#findComment-35972 Share on other sites More sharing options...
carlg Posted May 15, 2006 Author Share Posted May 15, 2006 [!--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 fineIf I place it in $DOCROOT/admin/, it dispays a blank page Link to comment https://forums.phpfreaks.com/topic/9684-php-cant-find-file-in-subdirectory/#findComment-36010 Share on other sites More sharing options...
carlg Posted May 15, 2006 Author Share Posted May 15, 2006 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 https://forums.phpfreaks.com/topic/9684-php-cant-find-file-in-subdirectory/#findComment-36075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.