Install Symfony on Vagrant Environment

Vagrant is a tool for building and managing virtual machine environments.

Assuming you have already installed and vagrant up your virtual environment. Execute the following instructions on your terminal console.

Download symfony installer
sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony

Create project directory
symfony new my_project

Then, you can:

* Change your current directory to /vagrant/my_project
* Configure your application in app/config/parameters.yml file.
* Run your application:
1. Execute the php bin/console server:run command.
2. Browse to the http://localhost:8000 URL.

* Read the documentation at http://symfony.com/doc

Running #1, should produce result similar to this:
php bin/console server:run

 [OK] Server running on http://127.0.0.1:8000

 // Quit the server with CONTROL-C.

If you have private network map set in Vagrantfile then do not use server:run as it only listens to http://127.0.0.1. Use the following instead:
php bin/console server:start 0.0.0.0:8000

As in my example:
php bin/console server:start 0.0.0.0:8000

 [OK] Web server listening on http://0.0.0.0:8000

Then access the site via the private network ip address:
http://xxx.xxx.xxx.xxx:8000/

To stop, use the ff. command:
php bin/console server:stop 0.0.0.0:8000

Comments

Post a Comment