Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
index.php不工作laravel 5_Php_.htaccess_Laravel_Laravel 5_Laravel Routing - Fatal编程技术网

index.php不工作laravel 5

index.php不工作laravel 5,php,.htaccess,laravel,laravel-5,laravel-routing,Php,.htaccess,Laravel,Laravel 5,Laravel Routing,我在index.php中遇到了一个问题。当我尝试运行应用程序时,我在浏览器中得到index.php文本 我正在使用ubuntu我最近从windows切换过来,那里的应用程序与xampp配合得很好。下面是我的目录结构的屏幕截图 下面是.htaccess文件 <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule>

我在index.php中遇到了一个问题。当我尝试运行应用程序时,我在浏览器中得到index.php文本

我正在使用ubuntu我最近从windows切换过来,那里的应用程序与xampp配合得很好。下面是我的目录结构的屏幕截图

下面是.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>

选项-多视图
重新启动发动机
#重定向尾部斜杠。。。
重写规则^(.*)/$/$1[L,R=301]
#处理前控制器。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
下面是浏览器中index.php文件的屏幕截图。

您必须配置apache2才能安装和启用mod_php

sudoapt安装apache2

sudo apt get安装php5

sudo apt get安装libapache2-mod-php5

sudo a2enmod php5

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

与.htaccess文件无关,因为它工作正常,请注意它按预期获取index.php,但apache不知道如何编译php文件,因此它将作为原始文本输出


关于,

那么您的服务器上没有php或者它不是活动的。我遵循了上面的步骤,但问题仍然存在。我的PHP版本是5.5.9.Ah,我忘了提到必须通过运行这个命令来启用PHP
sudoa2enmodphp5
,然后重新启动apache2。当做