Friday, 25 December 2009

how to use mySQL of MAMP

Navigating to http://localhost:8888/MAMP/ displays the Start page of MAMP with the mySQL settings.
In order to setup symfony to connect to mySQL database we need to run from the command this
symfony configure:database 'mysql:host=localhost;port=8889;dbname=test' root root

test is database name as created for my symfony project using the phpMyAdmin on the MAMP page. By default the port for MySQL is 8889, you can verify it on the MAMP start page. Same with the username and the password, which in this example is root both for username and password.

Wednesday, 9 December 2009

Configure Symfony project on MAMP

I try to learn symfony framework and figure out, the easiest to install it on my Mac would be to use MAMP, the current MAMP version I use is 1.8.2
  1. The symfony package is already installed as I used it when practising the jobeet demo. so in order to create a new project first we want to create a new folder. As we run the symfony commands from the shell we need to open terminal. Then using the mkdir command we create a new folder for our project.
  2. We need to be within the project folder, using cd command and we run the symfony command php /usr/bin/symfony generate:project [project name] in this case I created a symbolic link from the installation of symfony to /usr/bin this is necessary only first time after the creation of the project will have a shortcut to symfony from the project folder.
  3. To create new domain for your web development project, you need to update the following files: /etc/hosts and conf/apache/httpd.conf (in your MAMP folder) .
  4. After changing the server name you need to restart the MAMP service.
The next step is configuring a repository to store data for the web application. I use mySQL that comes with the MAMP, by defaults the port is 8889 and you need to remember that when coming to configure the database in symfony. I'll talk about it including how to use Doctrine in my next post.