在 apache2 中访问 php 页面时出现内部服务器错误

在 apache2 中访问 php 页面时出现内部服务器错误

安装 apache2 后,它可以正常工作,但如果重新安装 php5,服务器将无法工作,如果我尝试访问http://127.0.0.1给出错误 500,或者 www 文件夹的文件,如果我尝试访问文件夹或文件夹的文件,一切正常。错误 500 详细信息:

GET http://127.0.0.1/test.php

500 Internal Server Error Запрос GET /test.php HTTP/1.1 User-Agent:

Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16 Host:

localhost Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 Accept-Language: ru,en;q=0.9
Accept-Encoding: gzip, deflate
Pragma: no-cache
Cache-Control: no-cache
Connection: Keep-Alive
Ответ HTTP/1.0 500 Internal Server Error
Date: Sun, 13 Oct 2013 19:16:25 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.4.9-4ubuntu2.3
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Content-Type: text/html

不是错误500:

 GET http://127.0.0.1/css/


200 OK
GET /css/ HTTP/1.1 
User-Agent: Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16
Host: localhost Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: ru,en;q=0.9
Accept-Encoding: gzip, deflate
Connection: Keep-Alive Ответ HTTP/1.1 200 OK Date: Sun, 13 Oct 2013 19:21:38 GMT
Server: Apache/2.2.22 (Ubuntu)
Vary: Accept-Encoding
Content-Encoding: gzip Content-Length: 648 Keep-Alive: timeout=5,max=99
Content-Type: text/html;charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> [...]

答案1

您的 PHP 文件中似乎有错误,PHP 信息文件应该是:

<?php phpinfo(); ?>

<?id 按此折旧https://stackoverflow.com/a/200666

php_info()是一个不正确的函数名(除非您自己编写了代码),应该用分号 (http://php.net/manual/en/function.phpinfo.php

相关内容