phpinfo()在我的CentOS服务器上不起作用 [英] phpinfo() is not working on my CentOS server

查看:253
本文介绍了phpinfo()在我的CentOS服务器上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在CentOS服务器上安装了PHP.但是,在脚本中运行phpinfo()进行测试时,我收到的是HTML,而不是解释的信息.

I have PHP installed on my CentOS server. However, when running a phpinfo() inside my script to test it, I receive the HTML, not the interpreted information.

我可以看到PHP的文件夹.我什至可以在etc文件夹中看到php.ini. 但是PHP本身似乎无法正常工作.

I can see the folders for PHP. I can even see the php.ini in the etc folder. But PHP itself does not seem to be working.

我的意思是我的test.php文件看起来像这样:

I mean my test.php file looks like this:

<?php
    phpinfo();
?>

响应如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html><head>
<style type="text/css">
body {background-color: #ffffff; color: #000000;}
body, td, th, h1, h2 {font-family: sans-serif;}
pre {margin: 0px; font-family: monospace;}
a:link {color: #000099; text-decoration: none; background-color: #ffffff;}
...

以此类推.

似乎是问题所在,我该如何解决?

What seems to be the problem and how do I solve it?

如果我复制返回的HTML,将其粘贴到HTML文件中,然后从那里运行,我可以看到格式化的结果,但不能通过运行test.php来查看.我假设未以某种方式加载PHP ...即使在解释的HTML中我也可以看到:

If I copy the HTML returned, paste it into an HTML file, and run it from there, I can see the formatted result, but not by running the test.php. I assume PHP is not loaded somehow... even if in the interpreted HTML I can see the:

**Server API    Apache 2.0 Handler
Virtual Directory Support    disabled
Configuration File (php.ini) Path    /etc/php.ini
Scan this dir for additional .ini files    /etc/php.d
additional .ini files parsed    /etc/php.d/dbase.ini, /etc/php.d/json.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini
PHP API    20041225
PHP Extension    20050922
Zend Extension    220051025
Debug Build    no
Thread Safety    disabled
Zend Memory Manager    enabled
IPv6 Support    enabled
Registered PHP Streams    php, file, http, ftp, compress.bzip2, compress.zlib, https, ftps**

以此类推...

在此系统上,托管了三个网站.与这个问题有什么关系吗?

On this system, there are three websites hosted. Does that have anything to do with this problem?

推荐答案

这也发生在我身上.该修复程序将其包装在HTML标签中.然后,我将文件另存为/var/www/html/info.php 并运行 http://localhost/info.php 在浏览器中.就是这样.

This happened to me as well. The fix was wrapping it in HTML tags. Then I saved the file as /var/www/html/info.php and ran http://localhost/info.php in the browser. That's it.

<html>
    <body>
        <?php
            phpinfo();
        ?>
    </body>
</html>

这篇关于phpinfo()在我的CentOS服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆