简体   繁体   English

index.php无法正常工作laravel 5

[英]index.php not working laravel 5

I have a problem in index.php. 我在index.php中有问题。 When i try to run the application i get the text of index.php in the browser. 当我尝试运行该应用程序时,我在浏览器中得到了index.php的文本。

I am using ubuntu. 我正在使用ubuntu。 I recently switched from windows where application was working fine with xampp. 我最近从使用Xampp正常运行的Windows切换了 Following is the screenshot of my directory structure. 以下是我的目录结构的屏幕截图。

在此处输入图片说明

Following is the .htaccess file. 以下是.htaccess文件。

<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. 以下是浏览器中index.php文件的屏幕截图。 在此处输入图片说明

You have to config your apache2 to install and enable mod_php 您必须配置您的apache2才能安装并启用mod_php

sudo apt-get install apache2 须藤apt-get install apache2

sudo apt-get install php5 须藤apt-get install php5

sudo apt-get install libapache2-mod-php5 须藤apt-get install libapache2-mod-php5

sudo a2enmod php5 须藤a2enmod php5

sudo /etc/init.d/apache2 restart sudo /etc/init.d/apache2重新启动

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. 与.htaccess文件没有任何关系,因为它可以正常工作,请注意,它按预期获得了index.php,但是apache不知道如何解释php文件,因此将其输出为原始文本。

Regards, 问候,

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

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