Mac下MySQL错误排查:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 作者: liesauer 时间: 2019-10-06 分类: 开发 评论 ## 起因 原本已经装上的`5.7`版本是正常运行的,后来因为项目的需要,需要换个版本做测试,于是乎就使用`brew`安装了`8.0`版本的MySQL,然后启动后一连接就傻眼了,提示 ``` ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) ``` ## 查错 - 阅读剩余部分 -
如何正确地使用/更换Composer镜像 作者: liesauer 时间: 2019-09-26 分类: 开发 评论 ## 使用/更换镜像 全局(推荐) ```shell composer config -g repo.packagist composer https://xxx.com/composer/ ``` 项目 ```shell composer config repo.packagist composer https://xxx.com/composer/ ``` 取消镜像 ```shell 全局 composer config -g --unset repos.packagist 项目 composer config --unset repos.packagist ``` ## 查看当前镜像 ```shell composer config repositories ``` 输出以下信息 ``` {"packagist.org":{"type":"composer","url":"https:\/\/mirrors.aliyun.com\/composer\/"}} ``` 表示我已成功使用阿里云的镜像 - 阅读剩余部分 -
解决git操作github仓库因开启2FA提示验证失败的问题 作者: liesauer 时间: 2019-09-09 分类: 开发 1 条评论 # 问题 开启2FA后提示验证失败。 ``` Username for 'https://github.com': Password for 'https://username@github.com': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/your/repository.git/' ``` 需要注意的是,只有使用`HTTPS`才会这样,使用`SSH`是使用`SSH KEY`进行验证的。 # 原因 github开启2FA后,不再使用原来的密码进行验证,而是使用`ACCESS_TOEKN`,因此我们需要[新增](https://github.com/settings/tokens/new "新增")一条`TOKEN`,如果你只是进行常规git操作只需要勾选`repo`下的权限即可,添加成功后在git下输入密码时输入新添的`TOKEN`即可。 # 文章引用 [Creating a personal access token for the command line](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line "Creating a personal access token for the command line")
PHP,你怎么穿着品如的衣服? 作者: liesauer 时间: 2019-04-19 分类: 开发 评论 ## 运行环境 1. `PHP >= 5.4` 然而如果你的 `PHP` 版本小于 `7.1`,这段代码还是跑不了,会报`PHP Fatal error: Cannot access empty property`,要将以下语句移除才能运行起来 ```text null => '我是null', $prop = null; var_dump($dynamicVar->$prop); ``` 我猜测应该是 `PHP 7.1` 加强了对 `nullable` `void` 的支持,所以导致了属性可以为 `null` 的诡异写法。 ```php $value) { $this->$var = $value; } } } $dynamicVar = new DynamicObj([ null => '我是null', 0 => '我是数字', '1' => '我也是数字', '0我是_- 非法属性名☺' => '。。。', 0x123456 => 'hex test', ]); var_dump($dynamicVar); $prop = null; var_dump($dynamicVar->$prop); var_dump($dynamicVar->{'0我是_- 非法属性名☺'}); var_dump($dynamicVar->{0x123456}); $json = json_encode($dynamicVar); var_dump($json); var_dump(json_decode($json)); var_dump(json_decode($json, true)); ``` - 阅读剩余部分 -
PHP 5.6 弃用 $HTTP_RAW_POST_DATA 所带来的小坑 作者: liesauer 时间: 2019-03-27 分类: 开发 评论 ## 起因 在将服务器PHP版本升级至5.6之后,发现微信公众号不回复信息了,也没发现有报错信息。搞了好久,终于在 `register_shutdown_function` 中的 handler 里捕获到了如下错误信息: ```text 8192Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead.Unknown0 ``` 大致是说 `$HTTP_RAW_POST_DATA` 这个变量已经在PHP 5.6 中弃用且会在未来的版本中移除。 - 阅读剩余部分 -