Installing Symfony with Homestead
This method is really awesome as you are creating a VM that has all the necessary apps, like php latest version nginx etc, installed and ready for you to run laravel/symfony application.
Here I am just going to outline briefly the steps:
- Add homestead box using vagrant for e.g. on terminal I went to sites the I issued the command:
vagrant box add laravel/homestead. Or add –c if it gives errors
- Then navigate where symphony folder then clone the homestead repo
cd ~ git clone https://github.com/laravel/homestead.git Homestead
- Go to Homestead directory then run
when this is run the Homestead.yaml file is create at ~/.Homestead. This is where you need to do the mapping between virtual machine and your machine.
File permission issues
If you get file permission then on ~/.homtead/Homestead.yaml change the mapping as follows:
folders: - map: /Applications/XAMPP/xamppfiles/htdocs/sites/symfony to: /var/www/sympfony type: "nfs"
this then will allow you to change permission to var/cache to 777
If you get this error;
No input file specified symfony
php -i | grep "php.ini" to find where php.in is located in my case at Loaded Configuration File => /etc/php/7.0/cli/php.ini and change cgi.fix_pathinfo=1
If you get his error:
unix:/var/run/php5-fpm.sock failed on log or 502 error
That means that you would needed to install php5-fpm, to do that type:
php5-fpm sudo apt-get install php5-fpm
sudo curl –LsS https://symfony.com/installer -o /usr/local/bin/symfony sudo chmod a+x /usr/local/bin/symfony Installing composer globally sudo chmod a+x /usr/local/bin/symphony sudo mv composer.phar /usr/local/bin/composer
To be able to run /config.php you need to change web/config.php at this statement if (!inarray(@$SERVER['REMOTE_ADDR'], as described at this link
domain.local/config.php if you get an error to fix the time zone make sure to edit these two files:
sudo vi /etc/php/7.0/cli/php.ini sudo vi /etc/php5/fpm/php.ini
after this you need to stop(halt) vagrant and start again then run this:
php -i | grep timezone
then you need to run this command to install and enable the intl extension:
sudo apt-get install php5-intl
To run application on dev mode change web/app.php on this line $kernel = new AppKernel('prod', false); Change the keyword ‘prod’ to ‘dev’.