PDA

View Full Version : PHP include not working



versak
04-25-2009, 01:57 PM
I have just transferred a site that once worked on a different host, however now i receive the following error messages when trying to display my page:

Warning: include(/home1/entertc2/public_html/inc/header.php) [function.include]: failed to open stream: Permission denied in /home1/kingbelv/public_html/index.php on line 1

Warning: include() [function.include]: Failed opening '/home1/entertc2/public_html/inc/header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/kingbelv/public_html/index.php on line 1

the web address is : http://66.147.242.172/~kingbelv/

i tried changing permissions of my include files, but that didn't work. i tried changing the permissions of the index.php file and that caused a "Hiccup" on the server that displayed a 500page.

thanks in advance for any help

wysiwyg
04-25-2009, 02:02 PM
The path your script is attempting to include happens to be under another account.

/home1/entertc2/public_html/inc/header.php

versak
04-25-2009, 02:21 PM
thanks for the quick response. how can that be? i am using ::

<?php $_SERVER['DOCUMENT_ROOT'] ?>



should there be something else that i should be using?

felgall
04-25-2009, 03:18 PM
Unless the script is run by a cron job the root directory for any access is public_html

Simply start the name with a / for that directory and specify the location within it or leave off the slash to have it start from the current directory

/home1/entertc2/public_html/inc/header.php is lookin for a home1 directory within your public_html and not finding it.

That address would work if the script were run from cron and entertc2 is your account since from cron the root directory is three higher in the path.

versak
04-25-2009, 11:12 PM
i have solved the problem...

the temporary website with the ip address was not resolving the links properly, and when the actual site name was updating, it was a matter of changing some files i had name .html to .php. everything was correct in my coding except for my extentions. what worked as index.html with php code in it wasn't working, but once i made the files index.php within each folder, everything started working again.

thank you guys for your input...