Normal file search works.
$j=0; if ($handle = opendir($_SERVER['DOCUMENT_ROOT'].'/project/'.$_GET['project'])) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $fullname=getExtension($file); if ($fullname[1] == 'php') { $filenameX[$j]=$fullname[0]; $j++; } } } closedir($handle); }
But if I do an Ajax, that is, this script is an ajax request handler - it produces an error 500. Why? There are no other errors, checked in the lines. 500 error due to cycle
while (false !== ($file = readdir($handle))) the ways are all true. without ajax everything works.