Hello, everyone. I am using Moodle 1.6.1 and I am getting two specific errors, which appear to be some kind of function that does not exist. I haven't worked with PHP in a long time, and I couldn't seem to find the answer anywhere in the forums. Please take a look at them for me:
Warning: print_header_and_tabs(tabs.php) [function.print-header-and-tabs]: failed to open stream: No such file or directory in /srv/www/htdocs/moodle/mod/quiz/report/default.php on line 37
Warning: print_header_and_tabs() [function.include]: Failed opening 'tabs.php' for inclusion (include_path='/usr/share/php') in /srv/www/htdocs/moodle/mod/quiz/report/default.php on line 37
Under that, it says "1 Employee has made 1 Attempt"
I attached a screenshot of the issue. Any thoughts would be greatly appreciated. Thank you.
It is to do with how you have got PHP configured. In particular the include_path setting. This needs to include '.' in the list of paths.
Thanks for the response, Tim. I also noticed my PHP version is 4.4.0, and I did download the latest package ofo php5 and installed it. The phpinfo.php file displays that I have the old one still installed and running. Some of the sites out there look a bit extreme to transfer .php files to .php5 and whatnot. Any ideas how I could correct this problem without mangling my configurations?
Thanks!
Thanks!
It should not matter which version of PHP you are running.
It is the option settings that control how it work that are not quite right. For more information, see http://php.net/manual/en/ini.core.php#ini.include-path
It is the option settings that control how it work that are not quite right. For more information, see http://php.net/manual/en/ini.core.php#ini.include-path
I believe I got it to work for now. Thank you for all of your help. I added two characters in the default.php file which is located in /moodle/mod/quiz/report. It was really a simple fix.
On line 37, I changed
include('tabs.php');
to
include('./tabs.php');
Thanks again!
On line 37, I changed
include('tabs.php');
to
include('./tabs.php');
Thanks again!
Update:
I got a similar error when I went to Regrade the quiz (I really didn't want to regrade anything, I was simply clicking around looking for problems that may occur).
/moodle/mod/quiz/report/grading/report.php line 15
I changed:
require_once("editlib.php");
To:
require_once("./editlib.php");
Simply because of the fact that editlib.php is not in the same directory. So adding "./" to the beginning of the file will make it search in high directories.
Thanks again and hopefully this is useful to someone out there new to PHP.
I got a similar error when I went to Regrade the quiz (I really didn't want to regrade anything, I was simply clicking around looking for problems that may occur).
/moodle/mod/quiz/report/grading/report.php line 15
I changed:
require_once("editlib.php");
To:
require_once("./editlib.php");
Simply because of the fact that editlib.php is not in the same directory. So adding "./" to the beginning of the file will make it search in high directories.
Thanks again and hopefully this is useful to someone out there new to PHP.
Actually, the proper solution would be to make all these absolute includes, starting with $CFG->dirroot.
I don't understand this.
1- Why did Chris have to change include('tabs.php'); to include('./tabs.php'); and require_once("editlib.php"); To: require_once("./editlib.php"); when things work OK on my Moodle install without having to make those changes? Does Chris have a "special" install?
2- Tim, what do you mean by "the proper solution would be to make all these absolute includes, starting with $CFG->dirroot."
3- In file /moodle/mod/quiz/report/grading/report.php, why do I see 2 apparently different ways to address a library file:
require_once("editlib.php");
require_once($CFG->libdir.'/tablelib.php');
Does the second line refer to Tim's "proper solution"? If so, why has it not been implemented in line 1?
Yours confused ,
Joseph
1. In the screen shot of the error message at the start of this thread, look at the setting of include_path on that server (which is helpfully included in the error message). Compare this to the setting on your server.
3. editlib.php is in the same folder as mod/quiz/report.php, which is the top-level file that is being executed when /moodle/mod/quiz/report/grading/report.php used (think, for a moment, quite how wheird this is, for instance, the include would break if grading/report.php was included by a file in a different folder). Whereas tablelib is in a completely different folder.
2. Once you realise how bizare relative includes are in PHP (see the previous point) you will see why it might be more robust to avoid them.
4. (why has it not been done?) because the poeple who originally wrote the file, and everyone who has used it since, found that this worked, and were not aware of the potential problem. Why have I not fixed it yet? because I wanted to check what the Moodle house style was first. You will find a post from me, seeking clarification, in the general developer forum.
3. editlib.php is in the same folder as mod/quiz/report.php, which is the top-level file that is being executed when /moodle/mod/quiz/report/grading/report.php used (think, for a moment, quite how wheird this is, for instance, the include would break if grading/report.php was included by a file in a different folder). Whereas tablelib is in a completely different folder.
2. Once you realise how bizare relative includes are in PHP (see the previous point) you will see why it might be more robust to avoid them.
4. (why has it not been done?) because the poeple who originally wrote the file, and everyone who has used it since, found that this worked, and were not aware of the potential problem. Why have I not fixed it yet? because I wanted to check what the Moodle house style was first. You will find a post from me, seeking clarification, in the general developer forum.
Hi Tim,
Thanks for your detailed and clear reply.
Joseph
Thanks for your detailed and clear reply.
Joseph