Cron作业无法访问mysql

时间:2017-06-06 11:22:07

标签: mysql zend-framework cron vagrant

我花了两天时间遇到了一个大问题!

我使用vagrant zendframework和mysql制作网站,mysql在流浪盒中。

**现在我想做一个cron作业,让它使用zend函数来访问mysql。

  

尝试了max_allowed_pa​​cket,超时,不起作用。

当我在msg下面运行cron时会出现:**

> Warning: PDO::__construct(): MySQL server has gone away in
> /project/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php
> on line 129
> 
> Warning: PDO::__construct(): Error while reading greeting packet.
> PID=35388 in
> /project/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php
> on line 129
> 
> Fatal error: Uncaught exception 'PDOException' with message
> 'SQLSTATE[HY000] [2006] MySQL server has gone away' in
> /project/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:129
> Stack trace:
> #0 /project/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php(129):
> PDO->__construct('mysql:dbname=ec...', 'root', '', Array)
> #1 /project/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Pdo/Mysql.php(111):
> Zend_Db_Adapter_Pdo_Abstract->_connect()
> #2 /project/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Abstract.php(861):
> Zend_Db_Adapter_Pdo_Mysql->_connect()
> #3 /project/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Abstract.php(931):
> Zend_Db_Adapter_Abstract->quote(42972, NULL)
> #4 /project/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php
> on line 144

我google了很多,最多的答案是超时,但这对我来说不正确。救命!

提前致谢。

0 个答案:

没有答案