PHP 初学者问题(服务器问题)

发布于 2024-10-29 13:35:56 字数 216 浏览 2 评论 0原文

嘿!!

我刚得到一个运行 debian 的虚拟服务器。我刚刚安装了apache和php。现在服务器应该支持php了。

我上传了文件index.php:

<?

echo "Hallo";

?>

问题是,如果我向网站发出请求,我的浏览器想要下载文件。

可能是什么问题?

谢谢

Hy!!

I just get a vserver running debian. I just installed apache and php. Now the server should support php.

i uploaded the file 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

怀念你的温柔 2024-11-05 13:35:57

安装PHP后重启apache了吗?

/etc/init.d/apache2 restart

have you restarted apache after installing PHP?

/etc/init.d/apache2 restart
喜爱纠缠 2024-11-05 13:35:57

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

This could mean that the Mime extension of the File is not registered with the web server which means you will need to check if you have the PHP Interpreter installed as a extension/plugin in your server.

一念一轮回 2024-11-05 13:35:57

尝试:

<?php
    echo "Hallo";

默认情况下,short_open_tags 在可能的发行版中被禁用。如果您必须支持遗留页面,您可以在 php.ini 中启用它们,如果不需要,则只需使用上面的内容,您的代码将更加兼容。

Try:

<?php
    echo "Hallo";

The short_open_tags is disabled in may distributions by default. 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.

甲如呢乙后呢 2024-11-05 13:35:57

您的服务器未设置为在输出 PHP 文件之前对其进行解析。

查看这些页面:
http://www.phpbuilder.com/board/archive/index .php/t-7100332.html
http://www.petefreitag.com/item/516.cfm

Your server isn't set to parse PHP files before they are output.

Check out these pages:
http://www.phpbuilder.com/board/archive/index.php/t-7100332.html
http://www.petefreitag.com/item/516.cfm

许久 2024-11-05 13:35:57

如果您将其更改为 标记,您的页面可以正常工作,那么 vbence 是对的,可能就像 shanethehat 所说,如果您已经进行了更改,您只需要重新启动 apache到 php.ini,所有这些东西一起工作的乐趣之一是,你需要研究所有选项来找出这些东西在哪里失败,这样你就知道从哪里开始寻找修复它

(找到了为什么它没有显示,我没有将代码放在 php 标签周围)

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

(Found why it wasnt displaying, I hadnt put code round the php tags)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文