我是php的新手,我正在尝试从localhost
渲染一个php脚本。我安装并运行了apache2。我也安装了php5。
我在/var/www/html/
中有两个文件,一个是没有任何php的简单html文件。当我尝试浏览index.html
时,渲染效果很好。
我还有一个名为index.php
的文件如下所示:
<html>
<head>
<title>My first PHP page</title>
</head>
<body>
<?php echo date( "r"); ?>
</body>
</html>
从localhost http://localhost/index.php
浏览此文件时,页面显示为空白。
任何人都可以指出可能出错的地方吗?
答案 0 :(得分:-1)
创建phpinfo.php页面
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
然后在浏览器中导航到127.0.0.1/phpinfo.php,如果它没有显示任何内容,那么你必须设置php corectly。