A basic Ubuntu 12.04, PHP 5.5.x, MySQL 5.5, and Apache 2.4.x Vagrant and puppet configuration for Symfony or any other PHP based framework. The puppet modules were based on the laravel4-vagrant setup. A basic working knowledge of Vagrant is needed for setup as this README is quite sparse.
The following packages are also installed:
- curl
- git
- phpunit
- composer
- VirtualBox 4.3.10 >=
- Vagrant 1.5.3 >=
- Git
- Clone this repo
git clone https://github.com/crankeye/vagrant-symfony.git
- Run
vagrant up
in the newly created directory. - If your host OS is windows you must run the command from an administrator command prompt.
- Add
192.168.56.101 local.dev
to your HOSTS file. - SSH into the box and run
sudo composer create-project symfony/framework-standard-edition /var/www/project/ 2.4.2
- Modify
/var/www/project/web/app_dev.php
and add192.168.56.1
to the local ip security array or comment out the section entirely. - You should now be able to see http://local.dev/app_dev.php/ in your browser.
Currently using rsync on Windows hosts is the best way to overcome the slow Virtual Box synced folders. You can either use vagrant rsync-auto
to automatically push changes your changes to your box or your can utilize your IDE's deployment tools to automatically upload your changes.
I've found PHPStorm works well once you've configured the deployment settings correctly. The only minor annoyance is the need to do a vagrant rsync
after switching branches.
Tip: Clicking the "Remote Host" button will keep your SSH connection alive and greatly improve the transfer time.
To setup rsync on a Windows host you'll need to install using cygwin:
- Download and install cygwin.
- Add the rsync package and the openssl package.
- Add the cygwin bin directory (C:\cygwin64\bin) to your local path variable.
- Comment out the default synced folder in the Vagrant file and uncomment the rsync lines.
Your next vagrant up
will autmatically rsync your project directory to /var/www/project.
If you still want to use the native Virtual box synced folders you can move the cache to the /tmp/ folder within the guest machine by adding these two functions in the AppKernel.php to the AppKernel class:
public function getCacheDir()
{
return '/tmp/symfony/cache/'. $this->environment;
}
public function getLogDir()
{
return '/tmp/symfony/log/'. $this->environment;
}
- Username: root
- Password: root
- Database: development
- ServerName: local.dev
- ServerAlias: www.local.dev
- DocumentRoot: /var/www/project/web
This vagrant box is configured on a private network at 192.168.56.101 which is accessible from the guest OS. You can connect a GUI MySQL client by using the default port (3306) and a host ip of 192.168.56.101. See the Vagrant documentation for additional information.