【发布时间】:2015-12-12 11:23:55
【问题描述】:
我是 laravel 框架的新手。最近我做了一个简单的博客类型的网站。在localhost 中,它运行良好,没有任何问题,如果出现任何问题,我曾经做过composer update、composer dump-autoload 等。
但是当我将它迁移到服务器时出现以下错误。这是什么错误,我应该再次运行composer update 吗?如果是,那么我如何在我的服务器上运行它。我对这个问题一无所知,请帮助我。
Warning: require(/home/somedomain/public_html/CMS/app/http/helpers/backend/helpers.php): failed to open stream: No such file or directory in /home/somedomain/public_html/CMS/vendor/composer/autoload_real.php on line 58
而下一个错误是:
Fatal error: require(): Failed opening required '/home/somedomain/public_html/CMS/app/http/helpers/backend/helpers.php' (include_path='/home/somedomain/public_html/CMS/vendor/phpunit/php-text-template:/home/somedomain/public_html/CMS/vendor/phpunit/php-timer:.:/usr/lib/php:/usr/local/lib/php') in /home/somedomain/public_html/CMS/vendor/composer/autoload_real.php on line 58
我在 Laravel5 中做这个项目。如果错误是由index.php 引起的,那么这里是我的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);
我的主项目目录以CMS 文件夹开头。在同一个CMS 目录中,我有一个index.php,在CMS 文件夹中,我有一个app、bootstrap、config、database、vendor 文件夹等等。当我删除index.php 的所有代码并写入<?php echo "Hello World"; ?> 并转到我的站点somedomain.com 时,我得到"Hello World"`` 作为输出。如何解决此错误?
【问题讨论】:
-
确保您的目录结构在本地主机和公共服务器上都匹配。并确保您正在移动所有文件。听起来你至少忘记了一个。
-
确保您的存储文件夹在 chmod 777 中
-
它是一个可以运行控制台命令的 vps/专用服务器吗?
-
是的,您应该再次运行
composer update以安装所有依赖项 -
@vision,不,不是。除非你可以运行 shell 命令
标签: php laravel laravel-5 hosting