localhost/test.php 不返回任何内容
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23495807/
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
localhost/test.php returns nothing
提问by mOna
I am following a tutorial "PHP & MySQL for dummies"to build a web application. I created a simple test.php
file in web space (/var/www/html
). The problem is that when I type localhost/test.php
in the browser address window, it returns me an empty page. I tried localhost/php.info
and it worked well but I could not find why test.php
does not work.
我正在按照教程“PHP 和 MySQL for dummies”来构建 Web 应用程序。我test.php
在网络空间 ( /var/www/html
) 中创建了一个简单的文件。问题是当我localhost/test.php
在浏览器地址窗口中输入时,它返回一个空页面。我试过了localhost/php.info
,效果很好,但我找不到为什么test.php
不起作用。
This is the test.php code:
这是 test.php 代码:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo “This is a PHP line”;
phpinfo();
?>
</body></html>
I do appreciate any information.
我很感激任何信息。
Thanks.
谢谢。
采纳答案by OpenStark
You said that you put your script in /var/www/html
你说你把你的脚本放在 /var/www/html
So the link might be
所以链接可能是
localhost/html/test.php
本地主机/html/test.php
Also check the error log file for PHP error.
还要检查错误日志文件中的 PHP 错误。
# cat /var/log/apache2/error.log
EDIT: Change your quote, ” are for Word document and not programming ;-)
编辑:更改您的报价,“用于 Word 文档而不是编程 ;-)
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line</p>
<?php
echo "This is a PHP line";
phpinfo();
?>
</body>
</html>
回答by fred
I have tried with this..just type the word localhost followed with name of the work eg.. localhost/test.php in the navigate bar on your browser then click enter
我已经尝试过这个..只需在浏览器的导航栏中输入 localhost 后跟工作名称,例如 localhost/test.php 然后单击 Enter