我正在使用ubuntu14.04。我按照https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04安装了LAMP。我的apache2工作正常,我可以从localhost运行我的html代码(文件位于/ var / www / html)。 但是PHP代码没有被服务器识别。 我创建了一个文件info.php,它有一个小代码:
<?php
phpinfo();
?>
但是当我在localhost上运行此文件时,页面完全空白。运行时,控制台显示以下问题: &#34;未声明HTML文档的字符编码。如果文档包含US-ASCII范围之外的字符,则文档将在某些浏览器配置中使用乱码文本进行渲染。必须在文档或传输协议中声明页面的字符编码&#34;
我的error.log文件如下:
[Mon Nov 16 20:37:45.283256 2016] [mpm_prefork:notice] [pid 20929] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon Nov 14 20:37:45.283356 2016] [core:notice] [pid 20929] AH00094: Command line: '/usr/sbin/apache2'
[Mon Nov 14 20:40:24.735968 2016] [mpm_prefork:notice] [pid 20929] AH00169: caught SIGTERM, shutting down
[Mon Nov 14 20:40:25.840171 2016] [mpm_prefork:notice] [pid 22341] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.20 configured -- resuming normal operations
[Mon Nov 14 20:40:25.840227 2016] [core:notice] [pid 22341] AH00094: Command line: '/usr/sbin/apache2'
[Mon Nov 14 20:40:41.605555 2016] [mpm_prefork:notice] [pid 22341] AH00169: caught SIGTERM, shutting down
[Mon Nov 14 20:40:42.681091 2016] [mpm_prefork:notice] [pid 22602] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon Nov 14 20:40:42.681183 2016] [core:notice] [pid 22602] AH00094: Command line: '/usr/sbin/apache2'
[Mon Nov 14 20:41:40.780397 2016] [mpm_prefork:notice] [pid 22602] AH00169: caught SIGTERM, shutting down
[Mon Nov 14 20:41:41.858300 2016] [mpm_prefork:notice] [pid 25445] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon Nov 14 20:41:41.858389 2016] [core:notice] [pid 25445] AH00094: Command line: '/usr/sbin/apache2'
[Mon Nov 14 20:42:16.827964 2016] [mpm_prefork:notice] [pid 25445] AH00169: caught SIGTERM, shutting down
[Mon Nov 14 21:03:24.137314 2016] [mpm_prefork:notice] [pid 2734] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Mon Nov 14 21:03:24.147525 2016] [core:notice] [pid 2734] AH00094: Command line: '/usr/sbin/apache2'
[Mon Nov 14 21:07:46.182694 2016] [mpm_prefork:notice] [pid 2734] AH00169: caught SIGTERM, shutting down
[Tue Nov 15 10:40:33.259452 2016] [mpm_prefork:notice] [pid 2751] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Tue Nov 15 10:40:33.272838 2016] [core:notice] [pid 2751] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 15 10:53:47.215292 2016] [mpm_prefork:notice] [pid 2751] AH00169: caught SIGTERM, shutting down
[Tue Nov 15 10:53:48.283869 2016] [mpm_prefork:notice] [pid 4413] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Tue Nov 15 10:53:48.283959 2016] [core:notice] [pid 4413] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 15 11:34:57.239683 2016] [mpm_prefork:notice] [pid 4413] AH00169: caught SIGTERM, shutting down
[Tue Nov 15 11:36:22.382513 2016] [mpm_prefork:notice] [pid 2780] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Tue Nov 15 11:36:22.393188 2016] [core:notice] [pid 2780] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 15 11:46:26.058513 2016] [mpm_prefork:notice] [pid 2780] AH00169: caught SIGTERM, shutting down
[Tue Nov 15 11:48:56.045051 2016] [mpm_prefork:notice] [pid 3367] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Tue Nov 15 11:48:56.077525 2016] [core:notice] [pid 3367] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 15 12:45:56.797705 2016] [mpm_prefork:notice] [pid 3367] AH00169: caught SIGTERM, shutting down
[Tue Nov 15 12:45:57.866547 2016] [mpm_prefork:notice] [pid 5056] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Tue Nov 15 12:45:57.866640 2016] [core:notice] [pid 5056] AH00094: Command line: '/usr/sbin/apache2'
请帮助纠正并解决问题。 Thanx很多。