This has been reported on the forum ( eg. http://drupal.org/node/127773) but I don't see a mention of this problem in the issue tracker.

In my case, I attempted a fresh install of Drupal (both 5.0 and 5.1) on a CentOS server with PHP 5.2.1.

In both Drupal versions, I received the following error messages:

# The comment module is required but was not found. Please move it into the modules subdirectory.
# The filter module is required but was not found. Please move it into the modules subdirectory.
# The help module is required but was not found. Please move it into the modules subdirectory.
# The menu module is required but was not found. Please move it into the modules subdirectory.
# The node module is required but was not found. Please move it into the modules subdirectory.
# The taxonomy module is required but was not found. Please move it into the modules subdirectory.
# The watchdog module is required but was not found. Please move it into the modules subdirectory.

In fact all these modules are present in in the modules subdirectory.

Upon further investigation, I was able to track the problem down to the readdir() function call in file_scan_directory (file.inc). readdir() returned the proper information for the first few module directories, but then consistently returned false after about 8 modules.

As a result, the file_scan_directory function reported incorrect information to the drupal_system_listing function and drupal_verify_profile returns an incomplete module list during the installation.

Comments

radagast-1’s picture

I edited file_scan_directory to replace readdir() with scandir(). This allowed Drupal 5.1 to install normally.

So this seems to be a problem with readdir().

Unfortunately scandir() is only available in PHP 5.

drumm’s picture

Status: Active » Postponed (maintainer needs more info)

What version of PHP? What operating system? Are safe mode or any other sort of changes to PHP in effect?

radagast-1’s picture

Hi drumm,

My bug report answered both of your first questions. CentOS (specifically CentOS 5 final), and PHP 5.2.1. Please read it again.

No safe mode. The phpinfo is here for your information:

http://kevin.elgg.org/errors/phpinfo.php

andjules’s picture

just adding a little here - my drupal installed fine, but my server occasionally crashes with errors that point at this line in file.inc. I am on CentOS5 with php 5.1.6.
I tried replacing readdir() with scandir(), but views module broke. Still in need of a solution.

drumm’s picture

Category: bug » support

Try getting the latest version of PHP, which is 5.2.3.

It was mentioned that this might be an issue with GCC in the forum thread. Post what version you have.

This is almost certainly an issue with your server, not Drupal.

maximus007’s picture

Can you provide that rewritten code with scandir() instead of readdir() for those less PHP-savvy??

hamidrj’s picture

In order to make it work for any version of php(4, 5) I rearange the order of executions in file_scan_directory in file.inc under indludes folder like this:

function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $callback = 0, $recurse = TRUE, $key = 'filename', $min_depth = 0, $depth = 0) {
$key = (in_array($key, array('filename', 'basename', 'name')) ? $key : 'filename');
$files = array();

$file_array=array();
if (is_dir($dir) && $handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
$file_array[] = $file;
}
closedir($handle);
}

if( count($file_array) >0){

foreach( $file_array as $file){
if (!in_array($file, $nomask) && $file[0] != '.') {
if (is_dir("$dir/$file") && $recurse) {
$files = array_merge($files, file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1));
}
elseif ($depth >= $min_depth && ereg($mask, $file)) {
$filename = "$dir/$file";
$basename = basename($file);
$name = substr($basename, 0, strrpos($basename, '.'));
$files[$$key] = new stdClass();
$files[$$key]->filename = $filename;
$files[$$key]->basename = $basename;
$files[$$key]->name = $name;
if ($callback) {
$callback($filename);
}
}
}
}
}

return $files;
}

UrielAvalos’s picture

Version: 5.1 » 5.3

This is what I'm running:
Drupal: 5.3
MySQL database: 5.0.37
PHP: 5.1.6
Web server: Apache/1.3.39 (Unix) mod_fastcgi/2.4.2

I tried installing a new module and got a "missing comment module" error...
I tried using the above fix to file.inc but still got the same error message.
I also tried all the possible solutions from this forum post http://drupal.org/node/127773
but still no dice.

UrielAvalos’s picture

Nevermind.... at least in my case, it seems that the problem was a poorly written module...

http://drupal.org/project/comment_notify

It redefined all the functions given in the Comment module --- hence, the "missing" module... getting in touch w/ the author of the other module....

ricabrantes’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

No activity, Close..