phpinfo() 不工作它显示空白页但其他 php 工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11377026/
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
phpinfo() is not working it shows blank page but other php working
提问by Lpc_dark
I am completely lost as to why this is happening. I am on a server x10hosting. I have a PHP file named "phpinfo.php". Inside this file it says
我完全不知道为什么会发生这种情况。我在服务器 x10hosting 上。我有一个名为“phpinfo.php”的 PHP 文件。在这个文件里面它说
<?php phpinfo(); ?>
It doesn't say <? phpinfo(); ?>
它没有说 <? phpinfo(); ?>
For all I can tell it should be perfectly fine. If I try other PHP code they work.
就我所知,它应该完全没问题。如果我尝试其他 PHP 代码,它们会起作用。
For example
例如
<?php
echo '<div>hello World</div';
?>
works perfectly. What could possibly be the problem?
完美地工作。可能是什么问题?
采纳答案by brezanac
phpinfo()is disabled for free accounts on that particular hosting provider. You have to upgrade if you want access to phpinfo().
phpinfo()该特定托管服务提供商的免费帐户被禁用。如果您想访问phpinfo().
回答by Mihai Stancu
Use error_reporting(E_ALL);and ini_set('display_errors', TRUE);you might find an error saying that phpinfois on the restricted functions list (x10hosting may not want anyone to find out their configurations/ weaknesses etc.).
使用error_reporting(E_ALL);,ini_set('display_errors', TRUE);您可能会发现phpinfo在受限功能列表中出现错误(x10hosting 可能不希望任何人找出他们的配置/弱点等)。
回答by AlexVoloshin
Check your php.inifile, and grep for disable_function:
检查您的php.ini文件,并 grep 查找disable_function:
cat php.ini | grep -in "disable_function"
If the output has phpinfoin this line as such:
如果输出phpinfo在这一行中有这样的:
386:disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
386:disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
edit the file and remove phpinfofrom this line and save. You may need to restart httpd
编辑文件并phpinfo从该行中删除并保存。您可能需要重新启动 httpd
service httpd restart

