将 Laravel 个项目移至托管
Move Laravel project to hosting
我正在尝试将 laravel 项目移动到托管 Virtualmin,我移动了文档根目录中的所有文件夹
HOME/
MYPWD/
APP/
BOOTSTRAP/
CONFIG/
DATABASE/
....
PUBLIC_HTML/
在 PUBLIC_HTML 里面我有 index.php 这些行:
require __DIR__ . '/../bootstrap/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
login.php页面正常,但是登录后,浏览器return递归重定向导致错误。在日志中我得到这个错误:
exception 'ReflectionException' with message 'Class
App\Http\Middleware\isNotAuth does not exist' in
/home/mypwd/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
我应该换点别的吗?喜欢命名空间?
那是我的 composer.json 文件:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"doctrine/dbal": "^2.5",
"laravelcollective/html": "^5.2",
"symfony/event-dispatcher": "^3.2",
"psr/log": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\Foundation\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\Foundation\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
虽然这是我的 .gitignore 文件:
/vendor
/node_modules
/public/storage
Homestead.yaml
Homestead.json
.env
我自己解决了这个问题:服务器 linux 区分大小写,所以在 Kernel.php 中我用 IsNotAuth 调用了中间件 class,但文件名是 isNotAuth
我正在尝试将 laravel 项目移动到托管 Virtualmin,我移动了文档根目录中的所有文件夹
HOME/
MYPWD/
APP/
BOOTSTRAP/
CONFIG/
DATABASE/
....
PUBLIC_HTML/
在 PUBLIC_HTML 里面我有 index.php 这些行:
require __DIR__ . '/../bootstrap/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
login.php页面正常,但是登录后,浏览器return递归重定向导致错误。在日志中我得到这个错误:
exception 'ReflectionException' with message 'Class App\Http\Middleware\isNotAuth does not exist' in /home/mypwd/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
我应该换点别的吗?喜欢命名空间?
那是我的 composer.json 文件:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"doctrine/dbal": "^2.5",
"laravelcollective/html": "^5.2",
"symfony/event-dispatcher": "^3.2",
"psr/log": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\Foundation\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\Foundation\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
虽然这是我的 .gitignore 文件:
/vendor
/node_modules
/public/storage
Homestead.yaml
Homestead.json
.env
我自己解决了这个问题:服务器 linux 区分大小写,所以在 Kernel.php 中我用 IsNotAuth 调用了中间件 class,但文件名是 isNotAuth