【问题标题】:index.php not working laravel 5index.php 不工作 laravel 5
【发布时间】:2016-01-18 21:08:51
【问题描述】:

我在 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>

以下是浏览器中index.php文件的截图。

【问题讨论】:

  • 那你的服务器上没有php或者没有激活。

标签: php .htaccess laravel laravel-5 laravel-routing


【解决方案1】:

你必须配置你的 apache2 来安装和启用 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 重启

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

问候,

【讨论】:

  • 我按照上述方法进行操作,但问题仍然存在。我的 PHP 版本是 5.5.9。
  • 啊,我忘了说你必须通过运行这个命令sudo a2enmod php5来启用php,然后重启apache2。问候
猜你喜欢
  • 1970-01-01
  • 2015-12-08
  • 2018-08-11
  • 1970-01-01
  • 2016-05-15
  • 2017-06-08
  • 2018-12-25
  • 2015-09-22
  • 1970-01-01
相关资源
最近更新 更多