Isaac Diamond
Isaac Diamond

Reputation: 161

Issues with Symfony/Propel and MySQL

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 (#).

Upvotes: 3

Views: 1144

Answers (1)

Vitalii Zurian
Vitalii Zurian

Reputation: 17976

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

Upvotes: 1

Related Questions