Odd Script Anomalies Between Two Servers
Posted: Fri Mar 09, 2007 12:01 pm
I have a content editor that I wrote a LOOONG time ago and has since been re-written, however a client who is using it has encountered a problem I have yet to see anywhere else. They have been editting their classifieds page (a huge static html file), for over 2 years without problems, now all of a sudden it doesn't appear in the file-list in the application. The file size is fairly large, at 250kb.
I have done everything in my power to determine the cause of the problem, but I'm only coming up with memory limits, but the script execution is not halted, and error_reporting is coming up with nothing but a couple undefined indexes.
I have uploaded the exact script and files to a different host and everything works perfectly. I am at my wits end with this... If it was a simple out of memory problem, wouldn't the script die?
Server One (WORKS FINE HERE):
Server TWO (Fails on files over approx 90kb):
Relevant Code:
I have done everything in my power to determine the cause of the problem, but I'm only coming up with memory limits, but the script execution is not halted, and error_reporting is coming up with nothing but a couple undefined indexes.
I have uploaded the exact script and files to a different host and everything works perfectly. I am at my wits end with this... If it was a simple out of memory problem, wouldn't the script die?
Server One (WORKS FINE HERE):
Code: Select all
PHP Version: 4.3.10
PHP OS: Linux
Error Reporting: 2039 ((E_ALL | E_STRICT) ^ E_STRICT ^ E_NOTICE))
Register Globals: On
Short Tags: On
Display Errors: On
Magic Quotes GPC: Off
Magic Quotes Runtime: Off
Magic Quotes Sybase: Off
Memory Limit: 18388608
Loaded Extensions:
xslt xml wddx tokenizer
standard sockets session pspell
posix pfpro pcre overload
odbc mysql mhash mcrypt
mbstring imap gmp gettext
gd ftp exif dbase
dba curl ctype calendar
bz2 bcmath zlib openssl
apache cybercash Zend OptimizerCode: Select all
PHP Version: 5.2.1
PHP OS: Linux
Error Reporting: 6135 ((E_ALL | E_STRICT) ^ E_STRICT ^ E_NOTICE))
Register Globals: On
Short Tags: On
Display Errors: On
Magic Quotes GPC: On
Magic Quotes Runtime: Off
Magic Quotes Sybase: Off
Memory Limit: 128M
Loaded Extensions:
xmlwriter libxml dom xmlreader
xml wddx tokenizer session
pcre SimpleXML SPL PDO
soap siteguard SQLite standard
Reflection pdo_sqlite mysql mcrypt
json imap iconv hash
gettext gd filter dbase
dba date curl ctype
zlib openssl apacheRelevant Code:
Code: Select all
function getBlocks($f) {
$file = file_get_contents($f);
$pat = "#<!--EDITOR:([a-zA-Z0-9\-_ ]*?),([a-zA-Z0-9\-_ ]*?),([a-zA-Z0-9\-_ ]*?)-->(.*?)<!--:EDITOR-->#is";
//debug: echo "File [Name: {$f}] [Size: ".filesize($f)."]: ".print_r(preg_match_all($pat,$file,$mat,PREG_SET_ORDER),1)."<br/>";
if (preg_match_all($pat,$file,$mat,PREG_SET_ORDER)) {
$x=0;
foreach($mat as $v) {
$ret[$x]['name'] = trim($v[1]);
$ret[$x]['desc'] = trim($v[2]);
$ret[$x]['type'] = trim($v[3]);
$ret[$x++]['text'] = trim($v[4]);
}
return $ret;
}
return false;
}
function getAllBlocks($dir="./") {
$d = dir($dir);
$editBlocks = array();
$fileExt = array("html","php");
while (false !== ($entry = $d->read())) {
if ($entry != end(explode("/",$_SERVER['PHP_SELF'])) && in_array(end(explode(".",$entry)),$fileExt)) {
if ($temp = getBlocks($dir.$entry)) {$editBlocks[$entry] = $temp;}
}
}
$d->close();
return $editBlocks;
}