Problem with Include

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
leomoon
Forum Newbie
Posts: 4
Joined: Sun Jun 26, 2005 1:22 am
Location: Canada/Iran

Problem with Include

Post by leomoon »

Hello. I'm new here and I don't know much about PHP. And you might laugh at my question but...
I'm having problem with include. I made a php file that has 3 includes in it. If I put this file in root, it runs it. But when I put it in a subdirectory it doesn't want to work. It always gives me the "Internal Server Error"!!!

For example this one is in root and works -> http://leomoon.net/test.php
But this one which is in a subdirectory doesn't work -> http://leomoon.net/blog/test.php
Or subdomain version http://blog.leomoon.net/test.php

My php file is available here if you want to take a look at it. (.txt easy to read) -> http://leomoon.net/test.txt

Thanks. :)
hongco
Forum Contributor
Posts: 186
Joined: Sun Feb 20, 2005 2:49 pm

Re: Problem with Include

Post by hongco »

leomoon wrote: ..
My php file is available here if you want to take a look at it. (.txt easy to read) -> http://leomoon.net/test.txt

Thanks. :)
frankly, your test.txt didn't work either :roll:
leomoon
Forum Newbie
Posts: 4
Joined: Sun Jun 26, 2005 1:22 am
Location: Canada/Iran

Post by leomoon »

Very sorry. Now it should work.

:)
Revan
Forum Commoner
Posts: 83
Joined: Fri Jul 02, 2004 12:37 am
Location: New Mexico, USA
Contact:

Post by Revan »

If its doing a 500 error, I would look at Apaches configuration, or .htaccess, or even the PHP compile.
leomoon
Forum Newbie
Posts: 4
Joined: Sun Jun 26, 2005 1:22 am
Location: Canada/Iran

Post by leomoon »

So there is nothing wrong with the test.php file right?
I searched for .htaccess in "blog" directory. Nothing there. Something more interesting. If it's apache or .htaccess, there is another php file called gallery.php but that works!!! http://blog.leomoon.net/gallery.php

Why this damn test.php which is in the same directory doesn't work?
Because of this problem, I can't rebuilt my Movabletype with php extension!
User avatar
wwwapu
Forum Contributor
Posts: 197
Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland

Post by wwwapu »

Take a look at http://www.php.net/manual/en/function.include.php and especially examble 16-7 and couple of the paragraphs above it. I'm not sure, but you try to include .html through http, and this might cause the problem.
Revan
Forum Commoner
Posts: 83
Joined: Fri Jul 02, 2004 12:37 am
Location: New Mexico, USA
Contact:

Post by Revan »

leomoon wrote:So there is nothing wrong with the test.php file right?
I searched for .htaccess in "blog" directory. Nothing there. Something more interesting. If it's apache or .htaccess, there is another php file called gallery.php but that works!!! http://blog.leomoon.net/gallery.php

Why this damn test.php which is in the same directory doesn't work?
Because of this problem, I can't rebuilt my Movabletype with php extension!
If it's linux, the .htaccess is hidden.
leomoon
Forum Newbie
Posts: 4
Joined: Sun Jun 26, 2005 1:22 am
Location: Canada/Iran

Post by leomoon »

The problem was the premissions. It should set to 644. The person who helped me said you shouldn't have this problem but for your server it's like this...

Thanks for all your help. :)
Post Reply