我已将Laravel-5
项目上传到demo
folder
内的服务器,但当我访问mydomain.com/demo
时,我什么都没有,即空白页面。我实际上无法找到正在发生的事情,我认为这是因为.htaccess
文件或其他原因。
我demo folder
内的文件夹结构如下所示:
我的.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
我的debug
在app
文件中设置为true。我需要帮助。
答案 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:cache
和php artisan config:clear
实际上无需在.htaccess
中进行更改,也可以向777
文件夹授予storage
权限。我总是将此设置用于我的laravel
项目。它也适用于你的情况。