3
votes

I am attempting to to use Symfony2 with Propel ORM to generate SQL to be run on a MySQL database. The DB is running on a VM on port 3306. 3306 is forwarded by virtualbox to the VM so the database is accessible externally. Symfony2 is running on Apache, which is also located inside the VM.

When I attempt to generate the model classes using:

php app/console propel:build

everything works fine and the classes are usable in my project. However, when I attempt to generate the SQL using:

php app/console propel:sql:insert --force

I get an error saying:

Next exception 'PDOException' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away' in [REDACTED]/propel1/generator/lib/util/PropelSqlManager.php:259 Stack trace:

Followed by a stack trace.

I checked the config and parameters YML files and everything is correct. When I test connecting with pure PHP, using the exact same credentials, everything works just fine and I am able to execute SQL against the database.

Any thoughts as to what may be causing this? I feel like it may have to do with improper characters in yml because my password contains hash symbols (#).

1
Any chance you can try a password with no # to exclude this possibility?cheesemacfly
@cheesemacfly Ended up creating a new user just for propel with all privileges but I still get the error Next exception 'PDOException' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away' in [REDACTED]/propel1/generator/lib/util/PropelSqlManager.php:259 Stack trace: followed by a stack trace. It still appears to work with pure PHP. I should add that I turned on general logging and it appears that propel was not even executing any queries against the DB.Isaac Diamond

1 Answers

1
votes

This probably happens due to low resources of your Virtual Machine. Such error occurs usually on a timeout.

You can try increase these timeouts in your php.ini:

mysql.connect_timeout = 300
default_socket_timeout = 300