2015-10-20 83 views
1

我在index.php有问题。当我尝试运行应用程序时,我在浏览器中获取了index.php文本。index.php不工作laravel 5

我使用的是Ubuntu。 我最近从windows切换到应用程序正常工作与xampp。以下是我的目录结构的屏幕截图。

enter image description here

以下是.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文件的截图。 enter image description here

+0

然后有没有在您的服务器上的PHP或它是不活跃的。 – tkausl

回答

1

您必须配置您的Apache2安装和启用mod_php的

sudo易于得到安装的Apache2

命令和apt-get安装PHP5

命令和apt-get安装libapache2- MOD-PHP5

须藤a2enmod PHP5

须藤/etc/init.d/apache2重启

无关,与.htaccess文件,因为它做工精细,注意它得到的index.php,因为它的预期但是Apache不知道如何解读为此PHP文件,因此它作为原始文本输出。

问候,

+0

我遵循上述,但问题仍然存在。我的PHP版本是5.5.9。 –

+0

啊,我忘了提及你必须启用php,运行这个命令'sudo a2enmod php5',然后重新启动apache2。问候 –