May 25, 2005
If you have problems running some PHP scripts, don't give up hope. I've been having some problems with some things, and I just recently figured out the solution. If the script references itself, it may be doing it incorrectly. For example, in the webadmin.php script, there's a variable called
$self, and there's a little piece of code that defines it:The problem occurs when I click on a link in the file and it callsif (!empty($_SERVER['SCRIPT_NAME'])) {
$self = html(basename($_SERVER['SCRIPT_NAME']));
} elseif (!empty($_SERVER['PHP_SELF'])) {
$self = html(basename($_SERVER['PHP_SELF']));
} else {
$self = '';
}
.../php.exe?action=.... I'm not sure why this happens, but either way, you can fix it by defining $self = $_SERVER['PHP_SELF'];. That way, each time the code calls itself, it calls the right thing (its file name), not some sort of php.exe thing. I've seen this in a few other scripts, and the same fix has worked each time. #technology