您的位置:首页 > 编程语言 > PHP开发

Laravel错误解决方案

2016-05-06 22:59 851 查看
①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就正常了



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

[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[/code] 
⑨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

更过待续。。。。。。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: