Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fatal error: Call to undefined function: glob()

Status
Not open for further replies.

JASONE25

Technical User
Jun 23, 2005
54
NL
Hi experts i got an php script that when i run i get this error:

Code:
Fatal error: Call to undefined function: glob() in c:\inetpub\[URL unfurl="true"]wwwroot\test\avatars.php[/URL] on line 27

Code:
 $aFiles = glob("$sDir/$sPattern", $nFlags);

foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir)
  {
   $aSubFiles = rglob($sSubDir, $sPattern, $nFlags);
   $aFiles = array_merge($aFiles, $aSubFiles);
  }

  // The array we return contains the files we found, and the
  // files all of our children found.

  return $aFiles;
}

/* Get Listing of avatars */
$files = rglob (AVATARS_DIR.AVATARS_DIR_STOCK, '*');
sort ($files, SORT_STRING);

could an expert tell me how i can fix it. I am running php 4.2.0.
 
I am using mysql-3.23.58-win with PHP Version 5.0.4 and phpMyAdmin-2.6.3-pl1 .As soon as i upgraded my php this problem came!! Are these 3 can not work together?
 
JASONE25:
If you are using mysql 3.x, then you can use the mysql_* family of functions within PHP 5. So the getting everyting working should be doable. You just haven't jumped through enough hoops yet.

For starters, an equally good test for the presence or absense of an optional PHP family of functions is to use a phpinfo page. Create a page which reads in its entirety:

Code:
<?php
phpinfo();
?>

Using this instead of a PHPMyAdmin script will likely lower your frustration level.

On Win32, PHP is picky about in which directory it wants extension dlls. If you point your browser to the above script, what is the value for "extension_dir"?



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
sleipnir214 thanks for u reply.I run it and here what i got :

Code:
extension_dir        localvalue: ./    master value:   ./

Thanks
 
That value means "the current directory", which is of no help to your code.

From that same phpinfo() page, what is the value for "Configuration File (php.ini) Path"? We're going to edit that file.

In the directory tree where you installed PHP, create a likely directory for extensions. Call it whatever you like. Put the MySQL dll in there.

Then edit php.ini so that the "extension_dir" value matches that directory. Use an absolute pathname. This is as per the PHP online manual entry at the beginning of the chapter on the mysql_* family of functions, which reads:
As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
many thanks for u reply. I created a folder and called it ext and placed the 2 file inside it . The

value for "Configuration File (php.ini) Path is :
Code:
Configuration File (php.ini) Path  C:\WINDOWS\php.ini

i got one php.ini inside c:\php\BACKUP\php.ini . Should i edit that one ? what lines should i place in that php.ini?Thanks
 
The only php.ini file to which your PHP installation will pay any attention is the one your phpinfo() script designated. You can safely ignore any others, and I, for purposes of reducing confusion, recommend deleting any others.

Do the following:[ol][li]Create your standard directory for extensions whereever is convenient for you.[/li][li]Put the MySQL dll file in that convenient directory.[/li][li]Look in c:\windows\php.ini for a line which reads: extension_dir = "./"[/li][li]Edit that line of php.ini so that it reads as the same as your extension directory (i.e., if your convenient extension directory is c:\foo\bar, then make your line in php.ini read: extension_dir = "c:\foo\bar")[/li][li]Save the changes to php.ini[/li][li]Restart your web server[/li][/ol]




Want the best answers? Ask the best questions!

TANSTAAFL!!
 
no luck" is pretty vague.

What does your phpinfo() script say? Is it reporting what you think it should?

Are your web server's logs reporting anything?


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top