空白页 - laravel5上传到服务器

时间:2015-09-22 13:40:19

标签: php laravel laravel-5 cpanel

我已将Laravel-5项目上传到demo folder内的服务器,但当我访问mydomain.com/demo时,我什么都没有,即空白页面。我实际上无法找到正在发生的事情,我认为这是因为.htaccess文件或其他原因。

demo folder内的文件夹结构如下所示:

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文件如下所示:

<?php
/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylorotwell@gmail.com>
 */

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
|
*/

require __DIR__.'/CMS/bootstrap/autoload.php';



/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/CMS/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make('Illuminate\Contracts\Http\Kernel');

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

当我查看error_log文件时,我在最后一行找到了这些文件

[22-Sep-2015 09:48:07 America/Detroit] PHP Fatal error:  require(): Failed opening required '/home/axilcrea/public_html/demo/CMS/bootstrap/../vendor/autoload.php' (include_path='.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php') in /home/axilcrea/public_html/demo/CMS/bootstrap/autoload.php on line 17

我的debugapp文件中设置为true。我需要帮助。

1 个答案:

答案 0 :(得分:0)

demo文件夹中,在案例中创建一个新文件夹CMS。将项目的所有contents移到CMS文件夹中除public目录的内容之外,然后,copy级别中public目录的所有内容CMS目录。您的文件夹结构将类似于。

demo
  CMS
    app
    bootstrap
    config
    database
    resources
    storage
    and so on....
  assets
  robots.txt
  index.php

和您的index.php

require __DIR__.'/CMS/bootstrap/autoload.php';
 $app = require_once __DIR__.'/CMS/bootstrap/app.php'; 
另外一件事,在完成这些设置后,运行 php artisan config:cachephp artisan config:clear 实际上无需在.htaccess中进行更改,也可以向777文件夹授予storage权限。我总是将此设置用于我的laravel项目。它也适用于你的情况。