I'm installing Symfony2 2.6 on Windows 7 IIS. How can I configure the IIS for Symfony2? It looks the .htaccess conflicts with how IIS handles URL rewrite.
1) The only real trick for IIS should be converting some stuff in .htaccess for IIS. You don't really need everything in there, you just need these 2 things:
A) If the request is for a *real* file, serve that real file
2) Also, for local development, I highly recommend just using the built-in PHP web server. I rarely use a true web server locally anymore: http://symfony.com/doc/curr...
3) For production, if you want to run in Windows, you might want to also look into Azure - we have a cookbook article on deploying to Azure that Microsoft helped write: http://symfony.com/doc/curr...
I have noticed that the latest version of Symfony is strongly recommending people to use the "Symfony Installer", which actually looks really simple to use (great). However I keep getting an issue with "unable to create the cache directory". This seems very strange as I even set the umask to to 0000 and the cache and logs folder to 777. (Something I know to be a bit of a security threat, but it doesn't matter as it is just a local dev environment). What is equally strange is if I run /app_dev.php I get the "You are not allowed to access this file. Check app_dev.php for more information." If it helps, I am using Vagrant (here is my simple setup: https://github.com/JRCrawfo...
I'm guessing the issue might have something to do with Vagrant, is there any known issues with Vagrant and Symfony2?
I really like the installer too! About your issues, here's what's going on:
1) Sknce you're in a VM, it looks like requests are coming from some external (not 127.0.0.1) IP address. So, you hit the code at the top of app_dev.php that's meant to prevent someone from accessing the dev environment in case you accidentally deploy this file. Just remove this and make sure you don't deploy this file.
2) When you use Vagrant, it shares the directory between you host and VM, but the files are owned by your host machine. This means if you change file permissions in the VM, I'm not sure if that actually changes them on the host machine, where it matters. If your host machine is Windows, then you definitely can't get permissions correct, as they're fundamentally different than UNIX. For this reason - and for speed, you should probably move your cache directory out of your project. Check out http://www.whitewashing.de/....
Thanks for the tips Ryan, you helped me solve all the issues.
1) I haven't really looked at the app_dev.php file, but I saw that it was indeed just testing if the server was being run "locally", a rather nice check. I simply added my VM's internal IP to the list and this solved the issue.
2) The issue with Vagrant was a lot bigger however you were indeed correct that it was the file permission issues. Turns out that in a Vagrant box when I used chmod to try and update the folder permissions, this had no effect. However I noticed that this issue was also talked about in StackOverflow (http://bit.ly/1NQcbGX) In the end I just needed to add "config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777","fmode=666"]" to my Vagrantfile. While 777 would of course be a security issue for a live server, this works just great for local development.
8 Comments
I get "starwarsevents>" instead of "starwarsevents$"
What am I doing wrong?
Hey Lino!
I'm not sure I understand - what do you mean by "starwarsevents>" and "starwarsevents$"? Is this a directly name, or something different?
Thanks!
I'm installing Symfony2 2.6 on Windows 7 IIS. How can I configure the IIS for Symfony2? It looks the .htaccess conflicts with how IIS handles URL rewrite.
Hi there!
Ok, a few things to think about!
1) The only real trick for IIS should be converting some stuff in .htaccess for IIS. You don't really need everything in there, you just need these 2 things:
A) If the request is for a *real* file, serve that real file
B) Otherwise, serve app.php.
I don't use IIS, but there are some details on SO, which I hope will help: http://stackoverflow.com/qu...
2) Also, for local development, I highly recommend just using the built-in PHP web server. I rarely use a true web server locally anymore: http://symfony.com/doc/curr...
3) For production, if you want to run in Windows, you might want to also look into Azure - we have a cookbook article on deploying to Azure that Microsoft helped write: http://symfony.com/doc/curr...
Good luck!
I have noticed that the latest version of Symfony is strongly recommending people to use the "Symfony Installer", which actually looks really simple to use (great). However I keep getting an issue with "unable to create the cache directory". This seems very strange as I even set the umask to to 0000 and the cache and logs folder to 777. (Something I know to be a bit of a security threat, but it doesn't matter as it is just a local dev environment).
What is equally strange is if I run /app_dev.php I get the "You are not allowed to access this file. Check app_dev.php for more information." If it helps, I am using Vagrant (here is my simple setup: https://github.com/JRCrawfo...
I'm guessing the issue might have something to do with Vagrant, is there any known issues with Vagrant and Symfony2?
Hey John!
I really like the installer too! About your issues, here's what's going on:
1) Sknce you're in a VM, it looks like requests are coming from some external (not 127.0.0.1) IP address. So, you hit the code at the top of app_dev.php that's meant to prevent someone from accessing the dev environment in case you accidentally deploy this file. Just remove this and make sure you don't deploy this file.
2) When you use Vagrant, it shares the directory between you host and VM, but the files are owned by your host machine. This means if you change file permissions in the VM, I'm not sure if that actually changes them on the host machine, where it matters. If your host machine is Windows, then you definitely can't get permissions correct, as they're fundamentally different than UNIX. For this reason - and for speed, you should probably move your cache directory out of your project. Check out http://www.whitewashing.de/....
Let me know what you find out :). Cheers!
Thanks for the tips Ryan, you helped me solve all the issues.
1) I haven't really looked at the app_dev.php file, but I saw that it was indeed just testing if the server was being run "locally", a rather nice check. I simply added my VM's internal IP to the list and this solved the issue.
2) The issue with Vagrant was a lot bigger however you were indeed correct that it was the file permission issues. Turns out that in a Vagrant box when I used chmod to try and update the folder permissions, this had no effect. However I noticed that this issue was also talked about in StackOverflow (http://bit.ly/1NQcbGX) In the end I just needed to add "config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777","fmode=666"]" to my Vagrantfile. While 777 would of course be a security issue for a live server, this works just great for local development.
"... and if you dont use a version control. SHAME!" Anakin you're breaking my heart :'(
"Houston: no signs of life"
Start the conversation!