Include not working...

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
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Include not working...

Post by Dale »

OK on my site i have a new type of news thing and its in a directory called forums. Now i put this on my main page:

<? include ("/usr/local/etc/httpd/dale.unrealism.com/forums/PluhNews.php"); ?>

but is that wrong? Cuz then when i view the page its blank.
salto
Forum Commoner
Posts: 31
Joined: Thu Jul 04, 2002 7:50 am

Post by salto »

Dale, I am not sure, what do you mean by your 'main page'?
If it is your web page, you should make the path relative to your html doc, something like

Code: Select all

<?php include '/forums/PluhNews.php'; ?>
and leave out the (), but I might be wrong since I don't know what you try to accomplish.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Warning: Failed opening '/forums/PluhNews.php' for inclusion (include_path='') in /usr/local/etc/httpd/dale.unrealism.com/index.php on line 94

And on line 94 is <?php include '/forums/PluhNews.php'; ?>
User avatar
martin
Forum Commoner
Posts: 33
Joined: Fri Jun 28, 2002 12:59 pm
Location: Cambridgeshire

Post by martin »

I've tried opening
http://www.imahosting.com/dale/forums/PluhNews.php
and there seems to be no page there!
What is the actual url of the forum?
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Martin if you look in the INCLUDE PATH error..:

/usr/local/etc/httpd/dale.unrealism.com/index.php

I know its not obvious but the url to my forum is:
http://dale.unrealism.com/forums/

My Main Page:
http://dale.unrealism.com
salto
Forum Commoner
Posts: 31
Joined: Thu Jul 04, 2002 7:50 am

Post by salto »

Tell me is there still a problem, the forum is up and riunning on your site as far as I can see. If not: did you try modifications on

Code: Select all

<?php include '/forums/PluhNews.php'; ?>
like

Code: Select all

<?php include './forums/PluhNews.php'; ?>
or

Code: Select all

<?php include 'forums/PluhNews.php'; ?>
what type server is it running on?
fatalcure
Forum Contributor
Posts: 141
Joined: Thu Jul 04, 2002 12:57 pm
Contact:

Post by fatalcure »

yea, this should work:

<?php include("forums/PluhNews.php"); ?>
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

salto
1:
Warning: Failed opening '/forums/PluhNews.php' for inclusion (include_path='') in /usr/local/etc/httpd/dale.unrealism.com/index.php on line 94

2:
BLANK

3:
BLANK

fatalcure
1:
BLANK
salto
Forum Commoner
Posts: 31
Joined: Thu Jul 04, 2002 7:50 am

Post by salto »

Not much help, aren't we ?;-)
Ok, I don't have the answer but
1) Did you check the include path in your PHP info

Code: Select all

<?php phpinfo(); ?>
Does it point to the proper drive/directory or is there some weird reference which should be corrected. You can correct this in the php.ini
2) once in the directory where you are calling the PHP script, echo the path info

Code: Select all

<?php echo $PATH_INFO; ?>
that should be the proper position from the root of your website dir to the current directory. Copy this path in your include statement.
3) copy the script to the directory where you need it. In some settings the php file should be in the the same directory, depends on the configuration and/or sysadministrator.
User avatar
octane
Forum Newbie
Posts: 1
Joined: Sun Jul 14, 2002 2:58 pm
Location: Bremen, DE
Contact:

Post by octane »

What about

Code: Select all

<?php include './PluhNews.php'; ?>
and

Code: Select all

<?php include '../forums/PluhNews.php'; ?>
HTH
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

All Fail....

Heres my PHP INFO page:
http://####################
Last edited by Dale on Sun Jul 14, 2002 7:01 pm, edited 1 time in total.
salto
Forum Commoner
Posts: 31
Joined: Thu Jul 04, 2002 7:50 am

Post by salto »

Well, the only thing I can think of is you have no rights to the PluhNews.php. If you are on a shared host, contact the sysadm.
By the way: for security reasons it's better not to expose your php.info
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

I've changed my PHP INFO link :)
Post Reply