What was the exact error message?
Edit: oops, too slow.
Code:[Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning: include(): Failed opening '/include/bottom.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 134 [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning: include(/include/top.php): failed to open stream: No such file or directory in /var/www/index.php on line 7 [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning: include(): Failed opening '/include/top.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 7 [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning: include(/include/bottom.php): failed to open stream: No such file or directory in /var/www/index.php on line 134 [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] PHP Warning: include(): Failed opening '/include/bottom.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 134 [Wed Nov 07 14:41:48 2012] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico [Wed Nov 07 14:41:49 2012] [error] [client 127.0.0.1] PHP Warning: include(/include/top.php): failed to open stream: No such file or directory in /var/www/index.php on line 7
Last edited by CharlesA; November 7th, 2012 at 08:53 PM. Reason: code tags
thank you charles for the edit
Bah, I thought I hit submit, but I guess not.
Anyway, are you using the full path to the php files, or the relative path?
I checked one of my php files and I had this:
Code:<?php # Enter relative path to site's root directory $rootpath='./'; include_once ($rootpath."templates/header.php"); include_once ($rootpath."templates/nav.php"); ?>
Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide
Tomorrow's an illusion and yesterday's a dream, today is a solution...
the php page bottom.php is like this in the index.php page
include '/include/bottom.php';
exactly like that so I'm not sure why it wont call it if its in the same directory (/var/www/include)
PHP seems to want to have full UNIX paths, not anything with the web server. Two work-arounds exist.
One is to give the full path.
The other is to use a relative path.Code:include '/var/www/include/bottom.php';
I expect that there is a third way, the way that is actually correct, but these are the two obivous options.Code:include './include/bottom.php';
It might be due to an inconsistency or defect in PHP itself:
http://php.net/manual/en/function.include.php#94392
Here's yet another work-around:
http://roshanbh.com.np/2008/01/absol...on-in-php.html
Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide
Tomorrow's an illusion and yesterday's a dream, today is a solution...
I suspect the way to go is set an include_path, pointing to one or more directories where you collect your includes (that then can be referenced by bare filename in your code). And use includes (with relative or absolute path) as fallback, for special cases.
http://www.php.net/manual/en/ini.cor...i.include-path
thank you guys!!! it works great!!!
Bookmarks