Laravel错误解决方案

15 篇文章 0 订阅

①Laravel5路由\home 无法访问

在apache配置文件中将所有的 AllowOverride none;设置为AllowOverride all;配置文件具体位置因系统不同而改变,ubuntu14.0.1LTS 版本在/etc/apache2/apache2.conf文件中。


②500错误

安装完laravel后,打开马上出现了500错误,配置都是正确的,但是出现了500错误------------------>`500 (Internal Server Error)`

谷歌百度了很久找到了原来是要将sudo chmod -R 777 storage (给storage 777权限)


③仅能有一个AI

有一次使用php artisan migrate ------->结果报错了。。。。

原因是主键id是AI,而设置一个外键xx_xx_id是integer类型,这就冲突了,解决方法只需将xx_xx_id改为unsigned integer类型

(像这样的

$table->integer('role_id')->unsigned();

④邮件发送530错误

邮箱发送出现了如下问题:Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required,

从错误吗中看出是配置错误,但是我们检查了几次都是正确的,原因是缓存问题,这时候可以

清除缓存php artisan cache:clear     或           重启服务器php artisan serv

⑤使用create插入数据错误

如果使用create出现MassAssignmentException in Model.php line 448

从错误中看出是模型中没有定义白名单字段,解决如下:

class Contacts extends Model
{
    protected $fillable = ['name', 'mobile', 'email', 'address', 'created_at', 'updated_at'];
}

⑥compose update报错

错误为:Fatal error: Uncaught exception 'ReflectionException' with message 

解决方法可能如下:

1. composer dump-autoload

2. 配置文件错误,需修改,如我安装时改了配置文件.env,然后报错,这时候还原.env就正常了


⑦对于某些集成包,可能会禁用函数,报错:

[code]  [ErrorException]                                   
  passthru() has been disabled for security reasons
这时候我们使用:  sudo find / -name php.ini  搜索


可能位置有:/usr/local/php/etc/php.ini   

然后执行:  sudo vim /usr/local/php/etc/php.ini   

进入vim后使用 \disable_functions  

passthru,proc_open,proc_close,proc_nice,proc_terminate,leak,proc_get_status   去掉

⑧composer太慢了?换国内镜像

composer config -g repo.packagist composer https://packagist.phpcomposer.com

⑨composer老是require失败

1、报 [ErrorException] zlib_decode(): data error 错 
解决办法:执行 composer self-update 即可
2、在执行迁移或者数据填充时发生「class not found」错误 
解决办法:试着先执行 composer dump-autoload 命令后再进行一次。 //重新加载composer.json文件
3、提示以下类似的错误时
  Problem 1
- The requested package graham-campbell/credentials ~1.0 is satisfiable by g
raham-campbell/credentials[1.0.x-dev] but these conflict with your requirements
or minimum-stability.
解决方法:在composer.json中添加以下
"minimum-stability": "dev",  //这个遇上require时完全可以用上

⑩本地文件上传时报错如下:

报 ReflectionException Class *** does not exist 异常

解决方案:http://blog.csdn.net/bontian/article/details/50727140



更过待续。。。。。。。。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值