Symfony 2 Doctrine configuration for MySql database


This post provides a quick and dirty way to setup your doctrine configuration using Symfony v.20. 
I assume that you're using MySql database.

Step 1

First you need to enable your "pdo_mysql" driver in php.ini file. Just uncomment the following configuration in your php.ini. Restart your IIS and you're pretty much done.

extension=php_pdo_mysql.dll

Step 2


You need to have the following configuration in your symfony\app\config\parameters.ini file. 

    [parameters]
    database_driver="pdo_mysql"
    database_host="127.0.0.1"
    database_port="3306"
    database_name="testproject"
    database_user="root"
    database_password="root"
    mailer_transport="smtp"
    mailer_host="localhost"
    mailer_user=""
    mailer_password=""
    locale="en"
    secret="ThisTokenIsNotSoSecretChangeIt"


You might have noticed that the database_host "127.0.0.1". If you tried using "localhost" it won't work.


That's it and your website is Doctine enabled! :)

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm