====== Disabled Functions ======
If you use a cheap webhost, they may have disabled some PHP functions for "Security Reasons", this will probably break DokuWiki with errors like
Warning: xyz() has been disabled for security reasons
The first thing you should do is ask your Webhoster to change this or see if you can find a better hoster. If this is not a possibility you sometimes may be able to replace those functions.
To do so you need to find a replacement which doesn't use any of the disabled functions and put it into a ''inc/preload.php'' file, then you need to replace all calls to the disabled function with calls to your replacement in the whole DokuWiki code.
Below is a collection of a few replacements for functions used in DokuWiki:
===== readfile =====
Replaces [[phpfn>readfile]]. find all places where it is used : [[xref>readfile]]
function rpl_readfile($file){
$handle=@fopen($file,"r");
echo @fread($handle,filesize($file));
@fclose($handle);
}
===== glob =====
Replaces [[phpfn>glob]] (From php.net comment [[http://php.net/manual/en/function.glob.php#71083|#71083]]). find all places where it is used : [[xref>glob()]];
/**
* @author
*/
function rpl_glob($pattern, $flags=0) {
$split=explode('/',$pattern);
$match=array_pop($split);
$path=implode('/',$split);
if (($dir=opendir($path))!==false) {
$glob=array();
while(($file=readdir($dir))!==false) {
if (fnmatch($match,$file)) {
if ((is_dir("$path/$file"))||(!($flags&GLOB_ONLYDIR))) {
if ($flags&GLOB_MARK) $file.='/';
$glob[]=$file;
}
}
}
closedir($dir);
if (!($flags&GLOB_NOSORT)) sort($glob);
return $glob;
} else {
return false;
}
}
/**
* @author
*/
if (!function_exists('fnmatch')) {
function fnmatch($pattern, $string) {
return @preg_match('/^' . strtr(addcslashes($pattern, '\\.+^$(){}=!<>|'), array('*' => '.*', '?' => '.?')) . '$/i', $string);
}
}
===== parse_ini_file =====
See [[readinifile]]