Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get PHP to parse a file from subdirectory

Status
Not open for further replies.

carlg

Programmer
Jun 23, 2004
88
US
For some reason I can't get PHP to parse a file that is located in a sub directory of the DOCROOT. Any files placed in the DOCROOT are perfectly fine without problem.
See the example below (All html files work fine from sub directories); Thanks in advance for the help.


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

[myuser@localhost admin]$ pwd
/var/[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/[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/[myuser@localhost admin]$
 
Let me see if I understand correctly.

You have a script called y.php.

Two identical copies of this script reside in /var/ and /var/
Since the document root of your site is /var/ the two copies of the script can be reached at [ignore] and [/ignore], respectively.

However, [ignore] works but [/ignore] doesn't. Is this correct?



Want the best answers? Ask the best questions! TANSTAAFL!
 
You got it.

It's had me puzzled just about all day.

At first I thought that admin may be some sort of keyword so I changed the dir name to something else and same problem.

html files work perfectly fine in the subdirs

 
Tell me about your environment...OS, web server, whether you're running PHP as a CGI or a server module.


Compare the permissions on the subdirectory to the permissions on the document root. Are the ownership and permissions the same?



Want the best answers? Ask the best questions! TANSTAAFL!
 
I already did a
chmod 777 dirname

on the directory

Fedora Core 5 with apache webserver, PHP is a server module

It did have different owners, but I just changed that and still didn't work.

I also tried different browsers.

I am accessing the server from an XP mahcine
 
I THINK WE GOT IT!!!!!!

Thanks for all of your help!!!

I never thought of lookin in the error log (not sure why I didn't think of that)

Here was the problem

I have the following line in my php.ini file (which I put there for a purpose)

auto_prepend_file = Prepend.php


Prepend.php did not exist in the subdirectories, but when I copied it there, it works.

I think this was the problem.

I guess I should probably put the entire PATH of the file in php.ini


Thanks again

Carl


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top