简体   繁体   English

Apache2不显示PHP代码

[英]Apache2 doesn't show PHP code

I want to use my Raspi as a webserver so I followed this guide that basically set me up with an apache server and accompanying php modules. 我想将Raspi用作网络服务器,因此我遵循了指南, 指南基本上为我设置了apache服务器和随附的php模块。 This works for html webpages. 这适用于html网页。 The config file seems to suggest this module is being loaded by the apache server, but obviously something is going wrong since some test.php file: 配置文件似乎表明该模块正在由apache服务器加载,但是显然由于某些test.php文件出了点​​问题:

<?php phpinfo(); ?>

fails to produce any output. 无法产生任何输出。 I have reinstalled apache and have verified the (as far as I can see) correct url's to but to no avail. 我已经重新安装了apache并验证了(据我所知)正确的url,但无济于事。

How do I get to see my precious php info? 如何获得我宝贵的php信息?

Obviously I will supply required information. 显然,我将提供所需的信息。

In order to run php script with Apache web server, you have to install php package in your server and libapache module which is required by apache to run php scripts. 为了在Apache Web服务器上运行php脚本,您必须在服务器和libapache模块中安装php软件包,这是apache运行php脚本所必需的。 You can use following command to install php 您可以使用以下命令安装php

sudo apt-get install php5 libapache2-mod-php5

Hope it helps. 希望能帮助到你。

I've replalced the flashdrive with a clean raspbian and retried the process, and for some reason this time I do get the desired output. 我已经用干净的树莓派替换了闪存驱动器并重试了该过程,由于某种原因,这次我确实获得了期望的输出。 I have no idea what happened there. 我不知道那里发生了什么。

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

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