Laravel遇到的错误汇集

245 阅读1分钟

#1 Centos6.10 报SQLSTATE [HY000]: General error: 2036错误

使用laravel5.6+mysql8,在查询数据时,报SQLSTATE [HY000]: General error:2036错误.

将php的mysql驱动从 php-mysql 更换为 php-mysqlnd .

以centos6.10+php7.1为例:

yum remove php71w-mysql ##移除原有的php-mysql
yum install php71w-mysqlnd ##安装php-mysqlnd
service nginx restart  ##重启nginx服务
service php-fpm restart ##重启php-fpm服务 

#2 Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with

环境,ubuntu18.04 + php7.1错误如下

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Declaration of Symfony\Component\Translation\TranslatorInterface::setLocale($locale) must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::setLocale(string $locale)

解决方案,修改composer.json

"require": {
        "php": "^7.1.3",
        "symfony/translation-contracts": "^1.1.6",
        ...
    }