简体   繁体   English

初学者问题PHP(ServerQuestion)

[英]Beginner Question PHP (ServerQuestion)

Hy!! !!!

I just get a vserver running debian. 我刚得到一个运行debian的虚拟服务器。 I just installed apache and php. 我刚安装了apache和php。 Now the server should support php. 现在服务器应该支持php。

i uploaded the file index.php: 我上传了文件index.php:

<?

echo "Hallo";

?>

The problem is if i start a request to the site my browser wants to download a file. 问题是如果我向该网站发起请求,我的浏览器要下载文件。

Whats could be the problem? 可能是什么问题?

THX 谢谢

您在安装PHP后重新启动了Apache吗?

/etc/init.d/apache2 restart

这可能意味着文件的Mime扩展名未在Web服务器上注册,这意味着您需要检查是否已将PHP Interpreter作为扩展名/插件安装在服务器中。

Try: 尝试:

<?php
    echo "Hallo";

The short_open_tags is disabled in may distributions by default. 默认情况下,可能在may发行版中禁用short_open_tags If you have to support legacy pages you can anable them in php.ini , if not then just use the above, your code will be more compatible. 如果必须支持旧版页面,则可以在php.ini中启用它们,如果不支持,则只需使用上面的代码,您的代码将更加兼容。

Your server isn't set to parse PHP files before they are output. 您的服务器未设置为在输出PHP文件之前先对其进行解析。

Check out these pages: http://www.phpbuilder.com/board/archive/index.php/t-7100332.html http://www.petefreitag.com/item/516.cfm 查阅以下页面: http : //www.phpbuilder.com/board/archive/index.php/t-7100332.html http://www.petefreitag.com/item/516.cfm

If your page works if you changed that to the <?php tags, then vbence would be right, it could be as shanethehat says that you just need to restart apache if you've already made the change to php.ini, one of the joys of all these things working together you need to work through all the options to find out where these things fall down so you know where to start looking to fix it 如果您将页面更改为<?php标记,则页面正常工作,则vbence正确,这可能是因为shanethehat表示,如果您已经对php.ini进行了更改,则只需重新启动apache。所有这些事情共同带来的快乐,您需要仔细研究所有选项,以找出这些问题在哪里下降,以便您知道从哪里开始寻找解决方案

(Found why it wasnt displaying, I hadnt put code round the php tags) (发现为什么不显示,我没有将代码放在php标签周围)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM