Jamal Abdul Nasir
Jamal Abdul Nasir

Reputation: 2667

index.php not working laravel 5

I have a problem in index.php. When i try to run the application i get the text of index.php in the browser.

I am using ubuntu. I recently switched from windows where application was working fine with xampp. Following is the screenshot of my directory structure.

enter image description here

Following is the .htaccess file.

<IfModule mod_rewrite.c>

    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

</IfModule>

And following is the screenshot of index.php file in the browser. enter image description here

Upvotes: 1

Views: 1659

Answers (1)

Dat Pham
Dat Pham

Reputation: 1875

You have to config your apache2 to install and enable mod_php

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo a2enmod php5

sudo /etc/init.d/apache2 restart

Nothing to do with .htaccess file as it work fine, notice that it get index.php as it's intended but apache dont know how to intepret php file, hence it output as raw text.

Regards,

Upvotes: 1

Related Questions