Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

按照think-orm 接入的方式,接入了laravel ORM时,首次访问接口报错 #50

Closed
superlangs opened this issue Apr 4, 2019 · 10 comments

Comments

@superlangs
Copy link

接入了laravel ORM时,报 PDO::prepare(): send of 65 bytes failed with errno=32 Broken pipe

@superlangs
Copy link
Author

使用的mixphp版本是v1.1.1 ,

@onanying
Copy link
Member

应该是没有正常连接吧,think-orm 是可以的,理论上 laravel ORM 只要配置正确应该也是可以的,但只能在同步编程中使用。

@superlangs
Copy link
Author

我配置的是同步的模式,错误只发生在第一次访问接口的时候,后续都是正常的,网上搜索了下说是 mysql 配置下连接timeout 的时间,我配置成了一小时,但是还是没用

@superlangs
Copy link
Author

感觉像是连接超时之后失效了,重新访问接口,就好了

@onanying
Copy link
Member

那就应该是laravel orm 没有断线重连机制,think-orm 是有的

@superlangs
Copy link
Author

laravel 的 ORM是有断线重连的机制的,而断线MySQL会报 “MySQL server has gone away”的错误,但是现在报错的信息是 PDO::prepare(): send of 65 bytes failed with errno=32 Broken pipe

@onanying
Copy link
Member

断线的情况比你想想的要多的多,网关错误只是最常见的一种 https://github.com/mix-php/mix-database/blob/master/src/Persistent/PDOConnection.php#L113

@superlangs
Copy link
Author

是的,我看过laravel断线重连的代码,都是包含这些的,
image

@superlangs
Copy link
Author

附上我对接laravel ORM 的代码
image

@onanying
Copy link
Member

解决不了的话,建议还是接入 think-orm 吧,那个我测试是通过的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants