Web Hosting Talk







View Full Version : Problems with PHP include


ccondo
02-04-2005, 03:29 AM
We are currently trying to use a footer and header on our designs and we are having some issues on a Cpanel server.

I have a file named index.php that has 2 includes lines for header.htm and footer.htm.

When I try to view the page I get:


Warning: Unknown(/home/smart/public_html/index.php): failed to open stream: Permission denied in Unknown on line 0

Warning: (null)(): Failed opening '/home/smart/public_html/index.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0

Any ideas?

What is weird is it works fine with IIS!

I am guessing this is a security issue. If there is a better way to do this I am all ears.

Thanks!

Unknown_User
02-04-2005, 03:45 AM
Try using:

<?php require ($_SERVER["DOCUMENT_ROOT"]."/filename.php"); ?>


DislexiK

ccondo
02-04-2005, 03:59 AM
This worked like a champ!

cpscripts
02-04-2005, 06:44 AM
Originally posted by ccondo
Warning: Unknown(/home/smart/public_html/index.php): failed to open stream: Permission denied in Unknown on line 0

Warning: (null)(): Failed opening '/home/smart/public_html/index.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0

Any ideas?


Was your script uploaded to the web by the user "smart"? If not that error can caused if open base directory restrictions are in place which will prevent you from opening files owned by another user on the server.

CPSCRIPTS

cpscripts
02-04-2005, 06:46 AM
Originally posted by ccondo
This worked like a champ!

Posted too late I see :stickout: