架设laravel
2015-10-16 19:09
609 查看
用laravel 架设的用户单点登录授权系统,git clone项目文件后,需要下面的方法初始化,纪录以供项目成员参考
错误信息:`Warning: require(/http/www.mywakavLee.cn/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /http/www.mywakavLee.cn/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required ‘/http/www.mywakavLee.cn/bootstrap/../vendor/autoload.php’ (include_path=’.:/usr/local/lib/php’) in /http/www.mywakavLee.cn/bootstrap/autoload.php on line 17`
原因:网站根目录下缺少vendor这个存放laraver依赖包的目录
解决方法:使用
只出现一行Whoops, looks like something went wrong
解决:config/app.php 修改:'debug' => true
No supported encrypter found. The cipher and / or key length are invalid
然后mysql连接出错,没有配置数据库,
解决:添加.env文件,配置其中mysql 再执行导入数据库命令:php artisan migrate --path=database/migrations
apache .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
nginx
location / { try_files $uri $uri/ /index.php?$query_string; }
查看命令php artisan list
如添加controller文件 php artisan make:Controller XxxController
开发过程经常出现NotFoundHttpException in RouteCollection.php line 143:原因没有正确配置路由routes.php
添加英文语言包到resources/lang ,配置config/app.php内的
错误信息:`Warning: require(/http/www.mywakavLee.cn/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /http/www.mywakavLee.cn/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required ‘/http/www.mywakavLee.cn/bootstrap/../vendor/autoload.php’ (include_path=’.:/usr/local/lib/php’) in /http/www.mywakavLee.cn/bootstrap/autoload.php on line 17`
原因:网站根目录下缺少vendor这个存放laraver依赖包的目录
解决方法:使用
composer install进行安装(以前安装过的话使用:
composer update)
只出现一行Whoops, looks like something went wrong
解决:config/app.php 修改:'debug' => true
No supported encrypter found. The cipher and / or key length are invalid
解决:网站所在目录下执行命令 php artisan key:generate 将生成的key复制到config/app.php的APP_KEY键值。
然后mysql连接出错,没有配置数据库,
解决:添加.env文件,配置其中mysql 再执行导入数据库命令:php artisan migrate --path=database/migrations
apache .htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
nginx
location / { try_files $uri $uri/ /index.php?$query_string; }
查看命令php artisan list
如添加controller文件 php artisan make:Controller XxxController
开发过程经常出现NotFoundHttpException in RouteCollection.php line 143:原因没有正确配置路由routes.php
添加英文语言包到resources/lang ,配置config/app.php内的
'locale' => 'zh-CN', model字段和验证信息翻译成中文,
public $customeAttributes = [ 'name' => '唯一标识', 'display_name'=>'角色名', 'discription'=>'描述' ];
$this->validate($request, [ 'name' => 'required|unique:roles|max:255', 'display_name' => 'required', ],[], $this->customeAttributes); model内的各种设定
public $table = 'permission_role'; public $timestamps = false;//不添加created_at,updated_at
//protected $fillable = ['description', 'display_name'];//开启白名单字段,可以更改 protected $guarded = [];//保护字段,防止注入和上面的$fillable只可以有一个
相关文章推荐
- ubuntu下配置TFTP服务器,用以ubuntu下烧写内核到ARM开发板
- PHP7革新与性能优化
- thinkphp相关
- 用PHP递归统计系统中代码行数
- ftp错误
- php开发中的10大良好习惯
- 菜菜鸟Zend Framework 2 不完全学习涂鸦(四)-- 模块
- php编程中需要注意的10个常见的错误
- phpstorm 常用 快捷键
- windows server r2配置php环境
- sql这两个表和查询的组合yii通过使用数据库查询
- php5 mysqli 连数据库创建表
- php实现word转html文档卡死的问题
- php实现word转html文档的例子
- Yii 执行模型save方法时数据为空
- PHP函数之error_reporting()详细说明
- 菜菜鸟Zend Framework 2 不完全学习涂鸦(三)-- 例子功能设置
- 菜菜鸟Zend Framework 2 不完全学习涂鸦(二)-- 类库共享
- 菜菜鸟Zend Framework 2 不完全学习涂鸦(一)-- 安装配置
- php手册之static