Search code examples
phpapachesymfonysymfony-3.1

app.php shown as plain text on Symfony 3


Setting up my app to EC2 instance, I have the following virtual host:

<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=$1

   ## Custom fragment

 </VirtualHost>

But when I'm trying to get to app.php (When I access to the IP) I'm getting its content as plain text:

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);

UPDATE: Just Tried to add into httpd.conf the line:

LoadModule php7_module modules/libphp7.so but it it says:

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

I have tried many possible configurations but I can't get it, any idea what's happening?


Solution

  • install php and enable its extension for your web server