Tag Archives: windows 7

XAMPP and Windows: How to Create a Symbolic Link Tips, Tricks and Tutorials 25 NOV 2014

If you have scripts which need to be run in your local web browser but fall outside of your web root or any other declared vhost directory, there is always the option of simply creating symbolic links to these external locations from within your web root folder.

To do this (and I needed to on my Windows 7 environment to get around some Sencha ajax origin restrictions during debugging) follow the following steps:

1. Click the Start button to bring up the start menu.

2. Type cmd in the universal search box at the bottom of the start menu. (You should see at the top of the search results under Programs cmd.exe highlighted)

3. Press the Ctrl + Shift + Enter to launch the command prompt (cmd.exe) as Administrator. If you don’t do this, you’ll get a error saying that there are insufficient permissions to create the symbolic link later on. (You can also right click and select “Run as Administrator” to achieve the same thing.)

4. A box saying “Windows needs your permission to continue” will pop up. Click Continue.

5. Go to the directory you want to create the link in. For example: cd c:\xampp\htdocs\

6. Use mklink to create your symbolic link (or shortcut):

mklink /D externalfolder "c:\Users\username\Documents\My Folder\"

Note: The /D is there because, in this example, we are linking to a directory. “externalfolder” is the name of the symbolic link (change to whatever you want). Finally, the path is where the symbolic link actually resolves to.

Using the example laid out below, we could now point our browser to http://localhost/externalfolder/hello-world.php which would run just fine, with the browser executing c:\Users\username\Documents\My Folder\hello-world.php in reality.

Useful little trick to be aware of.

xampp logo

Windows 7: Manage Startup Programs Tips, Tricks and Tutorials 12 FEB 2014

The recommended way to manage which applications load on start in Windows 7 is of course to trawl through each application’s settings or options pages and control them from there. However, another more efficient way to do it (if you are a little computer literate) is to simply make use of the standard Windows System Configuration tool.

Launch the Microsoft utility by hitting the start button and entering ‘msconfig’ (without the quotes) into the search/run bar. Launch the msconfig.exe executable and navigate to the Startup tab.

There you’ll have a nice listing of all commands currently set to launch on start (registry entries basically), and can then manually trawl through the listing and deselect all the crapware and unnecessary loaders lurking there. (Make use of the Manufacturer and Command items to make sure you’re correctly identifying things before disabling them). Hit apply and then OK to prompt a machine restart.

(Of course, it is also worth your while to see what Services are running, because more often than not, unnecessary lurkers and loaders may very well be running a service to say for instance, ensure that the application command does in fact get launched. As suggested, the Services tab is managed exactly in the same way as the Startup tab, i.e. do exactly the same thing you just did to disable unwanted services!).

msconfig

Windows 7: Context Menu Image Resize: Image Resizer for Windows Software & Sites 08 MAY 2013

Having shifted to doing most of my work on a Windows 7 laptop here at home as opposed to my usual trusty Ubuntu workhorse that I’ve been using for the last couple of years, I needed to replace the useful functionality of quick image resizing via the context menu which I had simply adored on Ubuntu.

Luckily I found a great little replacement without too much difficulty: Image Resizer for Windows, written by Brice Lambson.

From their website: Image Resizer for Windows is a utility that lets you resize one or more selected image files directly from Windows Explorer by right-clicking. It was created so that modern Windows users could regain the joy they left behind with Microsoft’s Image Resizer Powertoy for Windows XP.

It’s a small download and a simple install, and I’m happy to report it works great, right out of the box. Well worth giving a run if quick image resizing is a game-changer for you then.

image resizer for windows ContextMenu

image resizer for windows ImageResizer

Related Link: http://imageresizer.codeplex.com/

XAMPP on Windows 7: Solving “client denied by server configuration” VirtualHost Error CodeUnit 05 FEB 2013

I don’t normally use Windows as my development environment, but after being handed a Windows 7 Fujitsu laptop at work, I set about getting my development environment up and running as fast as possible. XAMPP appears to be a popular way of setting up an Apache, MySQL and PHP stack, so I duly installed and then whipped open the C:\xampp\apache\config\extra\httpd-vhosts.conf file in order to add all my virtual hosts.

Nothing too complicated in there, pretty much only defining a DocumentRoot and ServerName directive, along with a simple Directory block containing an Order and an Allow directive. Next up with the C:\Windows\System32\drivers\etc\hosts file which was edited to allow for my subdomain and that should have been that. I fired up the XAMPP console, started both Apache and MySQL, and pleasingly http://localhost/ worked first time in my browser. Then I attempted to access my virtualhost – and nothing. Or rather a 403 denied access error message courtesy of my browser.

What followed was more than a hour of searching and tinkering with my setup, exploring folder security properties, directory name structures, config file alterations, all to no avail. Instead the “client denied by server configuration” error continued to taunt me at every turn.

I went to bed a frustrated man, and the next morning after an early rise and shine, I pulled out my chair and tackled the problem anew. And success!

The problem lies in the restrictive XAMPP httpd.conf file where it specified the “default” with a very restrictive set of features, the troublemaker here being a Directory block containing “Require all denied” (an authentication feature rolled out with Apache 2.4). What this means is that all incoming requests are denied. So back to our virtualhost specification, where we need to edit our Directory block and add a new rule to override the default setting.

Now we could go for “Require all granted”, but this is a little bit too open and not necessarily a practice that should be encouraged if you don’t need it. Instead, because this is for my local development environment, I’ll open up my vhost for the internal IP of 127.0.0.1, using the “Require ip xxx.xxx.xxx.xxx” directive.

So now my vhosts.conf entry looks like this:

<VirtualHost *:80>
DocumentRoot "C:\vhosts\surveythumb"
ServerName surveythumb
DirectoryIndex index.php
<Directory "C:\vhosts\surveythumb">
AllowOverride none
Require ip 127.0.0.1
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Solved!