app.php 在 Symfony 3 上显示为纯文本

app.php shown as plain text on Symfony 3

将我的应用设置为 EC2 实例,我有以下虚拟主机:

<VirtualHost *:80>
   ServerName melomaniacs.com

   ## Vhost docroot
   DocumentRoot "/var/www/html/myProject/web"
   DirectoryIndex  app.php

   ## Directories, there should at least be a declaration for /var/www/html/myProject/web

<Directory "/var/www/html/myProject/web">
       Options Indexes FollowSymLinks MultiViews
         AllowOverride None
         Order allow,deny
        Allow from All
        Satisfy Any
        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ app.php [QSA,L]
        </IfModule>
    </Directory>

   ## Logging
   ErrorLog "/var/log/httpd/melomaniacs_error.log"
   ServerSignature Off
   CustomLog "/var/log/httpd/melomaniacs_access.log" combined

   ## Server aliases
   ServerAlias *.melomaniacs.com
   SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=

   ## Custom fragment

 </VirtualHost>

但是当我试图到达 app.php 时(当我访问 IP 时)我得到的是纯文本的内容:

loadClassCache(); $kernel = new AppCache($kernel); // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter //Request::enableHttpMethodParameterOverride(); $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send(); $kernel->terminate($request, $response);

更新: 刚刚尝试将行添加到 httpd.conf 中:

LoadModule php7_module modules/libphp7.so 但它说:

[warn] module php7_module is already loaded, skipping when restarting apache.

我已经尝试了很多可能的配置,但我无法得到它,知道发生了什么吗?

安装 php 并为您的网络服务器启用其扩展程序