Amateur Protagonist Alister Sneddon

I once almost won a procrastinating contest, but I turned up.


Symlink Alias Files PHP And IIS

10th August 2014
By Alister Sneddon

Through and through I would say I prefer using a Windows machine over a Macintosh. However if you work on a LAMP stack it can be tough replicating your live environment on a Windows machine. As much as I hate it, developing PHP for a Linux environment on a Windows machine is tougher.

Sure you can use things like WAMP if you are a bitch arse pussy who wants to be spoon feed (or you want to learn more about LAMP without using a virtual machine.) however I enjoy using IIS. Using IIS for PHP and MySQL is not really the best environment and honestly I had no reason to use that setup for my local development.

A problem came up the other day when attempting to replicate one of our production systems. The system used a folder structure very common for fast multiple releases. The structure would mark every release with the date, and then a symlink is created called current which sits outside of the releases folder and simply points to the latest folder.

This system is a fantastic way to manage production releases before you get your hands on deployment tools. It means you can checkout your code and then easily switch folders with very little risk.

The problem was there is no out of the box method to create symlinks in IIS. Now I looked into this for a few hours and the general solution is Oh just use the virtual directory sadly depending on the complexity of your system more often than not, this just does not solve the issue.

Sure if you want domain.com/cowtipping to go to a different folder it's ok. Even then I do not believe it to be a good solution.

Another real problem is for users who might have a file which never changes e.g. settings.php or config.ini which must always be the same, it could contain database credentials or even just the salt you use. Either way the file must never change. Do not risk having it in your repository. This file should be symlinked in.

That is where IIS really hits the ground and frankly shits itself. The decision was then made I would scrap my function environment and attempt to use WAMP like the other developers. Again this all went well and somehow I got around the permission errors that follow me like the Black Death.

However we ran into the same issue. The problem is really at the OS level. Windows just does not have a nice solution to this issue. At one point I was creating shortcut files and even copying real symlink files and attempting to run them through Apache in hopes of tricking the system into working.

I love working with Windows, however every now and again you do have to throw your hands up and recognise a better solution. With a LAMP stack if you have a local development environment a Macintosh is a better solution. It really is a shame I just hate how a Mac works e.g. go fuck yourself case sensitive path names which doesn't work with Photoshop.

So really what I am saying is as the complexity of your live system grows you need to be able to replicate it better and better. In an ideal world you should have a box setup which is separate and that you remote/SSH into. However that is no always possible.

Also in regards to using a Linux system and then developing locally, that is like buying a cow because that is the only way to truly get fresh milk. You have to draw the line between practically and functionality. While running just Linux as your developing environment is extremely function it is very unpractical regarding support for tools you may require. Hopefully this changes one day.

You filthy comment whore, you love it don't you?
Lets not be forgetting to +1 it now... I am tracking your IP...