php PHP站点一直打开到空白页面,没有错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2473926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP site keeps opening to blank page, no errors
提问by gene
First, the premises: PHP loaded on IIS6 on Win2003 STD R2 SP2, PHP_5213 using FastCGI, MySQL_5145.
一、前提:PHP在Win2003 STD R2 SP2上IIS6加载,PHP_5213使用FastCGI,MySQL_5145。
Customer sent me the site files, which I unzipped to C:\InetPub\wwwroot\<site root>, then I created a new site in IIS, pointed to <site root>, added test.phpto the site files for testing and it works, but visiting index.phpproduces a blank page with no errors. The readme.txtfile present makes reference to application.phpand explains root folder var and sets it to a non-existent file.
客户向我发送了站点文件,我将其解压缩到C:\InetPub\wwwroot\<site root>,然后我在 IIS 中创建了一个新站点,指向<site root>,添加test.php到站点文件中进行测试并且它工作正常,但是访问index.php产生一个没有错误的空白页面。readme.txt存在的文件引用application.php并解释了根文件夹 var 并将其设置为不存在的文件。
I don't know PHP syntax, but I tried several logical changes with zero results. At this point I'm not even sure if that is the problem anymore. With PHP, MySQL & site debugging have put in over 20 hours. Still confused, I have resorted to heavy drug use and purchased a small firearm, loaded with a single round (even this seemed to take an inordinate amount of time). I've given up all hope.
我不知道 PHP 语法,但我尝试了几个逻辑更改,但结果为零。在这一点上,我什至不确定这是否是问题所在。使用 PHP、MySQL 和站点调试已投入 20 多个小时。仍然困惑,我已经诉诸于大量吸毒并购买了一支装有单发子弹的小型枪支(即使这似乎也花费了过多的时间)。我已经放弃了所有希望。
Someone please help save a new server and/or old administrator.
有人请帮助保存新服务器和/或旧管理员。
回答by Ignacio Vazquez-Abrams
Edit your php.inifile and set the display_errorsand display_startup_errorsoptions to Onso that you can have a chance to see what the problem is.
编辑您的php.ini文件并将display_errors和display_startup_errors选项设置为,On以便您有机会查看问题所在。
回答by DarthVader
Possible problems:
可能的问题:
server configuration, which might be due to php is not being executed , how can you tell, look at the source of the file on the browser.
服务器配置,这可能是由于没有执行php,你怎么知道,在浏览器上查看文件的来源。
If you have an error in the php file, it might not wr0k, you can add two lines of code to report errors.
如果php文件有错误,可能不是wr0k,可以加两行代码报错。
error_reporting(E_ALL | E_STRICT);
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
check your logs.
检查您的日志。
If you are not familiar with php configuration with FastCGI or IIS you can use lamp bundles for windows.
如果您不熟悉 FastCGI 或 IIS 的 php 配置,您可以使用适用于 Windows 的灯包。
回答by Night Owl
When moving files from one server to another and getting the blank page, check whether the code is using short opening php tags like <?instead of the full <?phpopening tag. If it is and the original server has the following line in the php.ini file...
将文件从一台服务器移动到另一台服务器并获取空白页面时,请检查代码是否使用了简短的 php 开头标签,<?而不是完整的<?php开头标签。如果是,并且原始服务器在 php.ini 文件中有以下行...
short_open_tag = On
but the new server has...
但是新服务器有...
short_open_tag = Off
then the blank screen may be the result.
那么结果可能是空白屏幕。
回答by Heckman
I've worked with a few servers I didn't have full access to and some didn't have errors enabled by default. I had to call echo error_get_last() at bottom of each page.
我使用过一些我没有完全访问权限的服务器,有些服务器默认没有启用错误。我不得不在每个页面的底部调用 echo error_get_last() 。

