简体   繁体   English

PHP die 预防白屏死机?

[英]PHP die PREVENTING White Screen of Death?

I am trying to enumerate through a perfectly valid array using php 5.3.5 on Joomla 1.5.我正在尝试在 Joomla 1.5 上使用 php 5.3.5 枚举一个完全有效的数组。 Whenever I try to access the array I get the white screen of death.每当我尝试访问数组时,我都会得到白屏死机。 If I add a die() statement right after then I get the array, (but of course, execution after that is halted).如果我在之后添加一个 die() 语句,那么我会得到数组,(当然,之后的执行会停止)。 I purposely put no code after array call and die() for debugging purposes.出于调试目的,我故意在数组调用和 die() 之后不放任何代码。 Removing die doesn't echo the array.删除 die 不会回显数组。 Has anyone else had this issue before?以前有没有其他人遇到过这个问题?

Edit: yes, turned error checking on.编辑:是的,打开了错误检查。 WSOD is BLANK. WSOD 为空白。

**in the View class:**

$seminarsRefDB =& JFactory::getDBO();
                $seminarsRefQuery = [MYSQL STUFF]
                $seminarsRefDB->setQuery($seminarsRefQuery);
                $seminarsRefList = $seminarsRefDB->loadAssocList();


for($i=0; $i<count($seminarsRefList); $i++) {

$classAppendix = $i;
                $seminarselects[] = JHTML::_('select.genericList', $seminar_options, 'seminar_title[]', 'class="seminardropdown" style="width:200px;"', 'value', 'text', $seminarsRefList[$i]['value'], 'seminar'.$classAppendix);
            };



$this->assignRef('seminarsArray', $seminarselects);


**In the Default Template**

print_r($this->seminarsArray[0]);
die;

END结尾

I have another array called speakersArray which is echoed perfectly.我有另一个阵列,称为扬声器阵列,它完美地回响。 I copied this code verbatim from the backend of my site where both arrays show no problems.我从我网站的后端逐字复制了这段代码,其中 arrays 都没有问题。

Used get_included_files and the default template is the last file included, so execution stops there.使用 get_included_files 并且默认模板是包含的最后一个文件,因此执行停止在那里。

You should turn on display_errors and error_reporting to E_ALL so you don't get a white screen of death and have your server tell you what errors it is getting.您应该打开 display_errors 和 error_reporting 到 E_ALL,这样您就不会出现白屏死机,并让您的服务器告诉您它遇到了什么错误。

It sounds to me that if its a big array and your passing it around, you could be running out of memory at some point in the code.在我看来,如果它是一个大数组并且你传递它,你可能会在代码中的某个时刻用完 memory。 By placing a die right after the array, you may have not hit that threshold yet.通过在阵列之后放置一个骰子,您可能还没有达到那个阈值。

Though iLLin's approach is fine for development testing, this is bad practice for a live site.尽管 iLLin 的方法适用于开发测试,但这对于实时站点来说是不好的做法。 Assuming you have access to your server, view the error log file to find out what is going on here.假设您可以访问您的服务器,请查看错误日志文件以了解此处发生的情况。

tail -f error_log尾 -f 错误日志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM