Starting out with Drupal or require some help with setting up your web development environment?
Drupal is becoming quite common, I know people who have jobs in development organisations that focus solely on Drupal development for their clients and one person’s job is just to ‘theme’ those Drupal builds. The chances are that Drupal will become more commonplace for web developers as clients look for increased functionality that sometimes lacks in WordPress (Joomla is another that is often spoken of for this purpose but that’s not something I can help you with) but don’t want the overhead of creating a bespoke system from scratch (which also wouldn’t be regularly updated by a large open-source community).
The first thing to say is that you need to be confident in your development setup – if you already have a good knowledge of debugging and a PHP IDE setup then I don’t need to say any more on that and you can skip the next section – if however you aren’t using virtual hosts, you don’t have a secure debugger, you’re using Windows and you aren’t confident with your IDE then the next sections are for you and I advise you to work through them slowly but surely.
Let’s start setting up your development platform
If you’re using XAMPP I recommend removing it and installing WAMP, I ‘grew up’ with XAMPP but WAMP offers so much more for a beginner/ intermediate developer (and beyond) and if you’re not that confident at editing configuration (config/ conf/ ini) files then get rid of that XAMPP and (or just, if you’ve not got anything yet) download that WAMP!
When downloading WAMP be sure you take note of their recommendation on C++ redistributables – i.e. download and install them. Be aware of your Windows type (32 bit or 64 bit – for an explanation and more information on this check out Microsoft’s guide, but come back). This is important and if you don’t know yours then click Start > (My) Computer > System Properties (a tab towards the top) and there in the ‘System’ section you’ll see your ‘System type’. Make sure you know it because there will be repercussions later if you don’t.
Next head on over to WampServer’s homepage to get that lovely stuff. Click on ‘Start using WampServer’ (as of March 2013) and you’ll find a variety of options to download. Great – that’s a good thing! Now if you look at the options, you’ll see it’s slightly misleading as all of the options have Apache, Mysql, PHP, XDebug, XDC, PhpMyadmin, SQLBuddy and webGrind. The versions of these might be different, but don’t worry about that – instead pick the first one in the list that corresponds with your system type – either 32 or 64 bit (unless you specifically have to choose a certain version of something, in which case select that with your appropriate system type)
Now take note of WampServer’s notices and download the Visual C++ Redistributable if required. If you’re not sure – download the one that corresponds with your system type (32 or 64 bit) anyway, the installation screen won’t offer an installation offer if you’ve already got it, instead it will say repair, remove or similar – cancel the process and ignore the Program Compatibility Assistant’s prompt that it might not have installed correctly. After you’ve checked the redistributable, choose the first link in the first paragraph on the WampServer download screen (as of March 2013 this is ‘you can download it directly’ – I won’t include a link because that circumvents the selection of 32 bit or 64 bit as I’m running 64 bit and that link will likely be out-of-date soon anyway). You’ll be taken to a Sourceforge page where you can run/save the file – one way or another you’ll want to run it.
Allow the installation if you’re prompted by a Windows warning and welcome to WampServer’s installation wizard. Click all the usual disclaimers and select additional icons etc. if you want, in other-words keep clicking next. The extraction of the files will take a minute or so on a modern processor.
When that’s done it will ask you for your default web browser, find your Firefox/Chrome etc. folder (Computer > C: > Program Files (86)) and select the .exe or as it says, ‘If you are not sure, just click Open’ to use Internet Explorer. Installation will finish and you’ll have to select the appropriate networks for it to be working on, I’d advise limiting it to Private networks, ‘such as my home or work network’. Allow that access and click next on the SMTP and Email options, because the chances are you’re not running a mail server on your laptop! Finally we can launch WampServer.
Now you should notice a little ‘W’ icon in your system tray (bottom right) that turns from red, to orange then to green. Then, helpfully, it will disappear. We want that icon to appear permanently in your system tray as you’ll be clicking it a lot. Left click the white up arrow to the left of the system tray and click ‘customize’. Find your WAMP icon (listed under ‘Aestan Tray Menu’ on mine) and choose ‘show icon and notifications’. Now you should have a little green ‘W’ in a box in your system tray.
Setup virtual hosts
This might seem an extraneous step, but it’s far better to get this step nailed now before you start wishing you had a separate sandbox-type (i.e. a safe and independent ‘play thing’) for when you want to try something out or when you inevitably have more than one project on the go.
Setting up virtual hosts is simply a process to follow (detailed here) that allows you to have more than one ‘website’ running on one machine, and it’s commonplace for webhosts to allow for such a thing so it’s worth doing.
If you’re not experienced (at all) in Linux type systems (and therefore file management) or you generally only concern yourself with the actual website’s folders, then this is where WampServer really helps – it provides shortcuts to commonly used files that we need to edit for the virtual host setup. However it can be a good excuse to start familiarising yourself with file management systems that are above and beyond the Windows ‘My Documents’ style setup, so you might want to have a go at finding the files yourself in the Windows Explorer system (the folders and files display from C:\ onwards). Another thing to note is that it’s good to have file extensions being displayed – if they aren’t then to do that click Start > Control Panel > Appearance and Personalization > Folder Options > View (which is a tab) and ‘un-tick’ ‘Hide extensions for known file types’.
Windows Hosts file
The next step is to enter the brave new world (if it’s new to you anyway – otherwise please excuse my condescension) of the Hosts file. This is located in
A quick way to get there is to select… C:\Windows\System32\drivers\etc and copy that into the navigation bar at the top of the Windows Explorer and press return. Otherwise, work your way up the file path.
You should see a folder with hosts, lmhosts.sam, networks, protocol, services or some-such variety. Interestingly you’ll note that there are no extensions being displayed here (except lmhosts.sam) because there are none, but it’s still important to display them. Now we open hosts, but wait for there is another issue to take note of…
It’s important (and will save you headaches) to realise that although we’re in Windows, not Linux, we do still sometimes have to run certain things as administrator (this should be OK if you are logged in as an ‘administrator’ Windows User Account). Editing the hosts file requires this, so before we open hosts, find Notepad and right-click it, rather than left clicking it as we usually do, and select ‘Run as administrator’ (with a shield icon to the left of it). Allow the User Access Control when prompted then go to File, click Open and find the hosts file (again, copy C:\Windows\System32\drivers\etc into the navigation bar at the top and it will take you straight there. It’ll look empty, because it’s looking for files with extension ‘.txt’, so next to ‘File name:’ click on the file type button with the down arrow that currently says ‘Text Documents (*.txt)’ and select ‘All Files (*.*)’. Yata! There you’ll see hosts, open it!
Editing the ‘hosts’ file as administrator
As it says at the top (commented out with #s), this file maps IP addresses to host names, which means we can map our localhost (the not-over-the-internet, not even requiring an internet connection, local network that exists just on our machines) to various host names (‘website’ names) that we want to further match with folders on our computer (i.e. ‘localhost’ network location otherwise being known as ‘somesitename.local’ -> C:\somesitenameDevelopmentProject\). The reason this is helpful is because otherwise we would need to be using a folder in WAMP that is C:\wamp\www\somesitenameDevelopmentProject\ which can get irritating and makes setting up a PHP debugger slightly more cumbersome.
We don’t need to do much here but it helps if you understand the concept underlying this process. You should already have an entry
That’s showing us that we have an IP address of
which is the loop-back interface of our machine, allowing us to be both server and client – exactly what web developers need. This IP address is matched with the hostname
We want to add entries that match 127.0.0.1 with whatever we want to name our address to access it over a web browser, so if we go with ‘sandbox’ and give it the extension ‘.local’ (for our pleasure) we want an entry that looks like this…
[TO BE CONTINUED] – apologies for the lack of an ending here, but I figured I’d never finish the guide if I didn’t at least post SOME of it!
Eclipse is a widely used development environment for various languages, the one we’re interested in is PHP so what we need is Eclipse and the PHP Development Tools (PDT) plugin. I was using Eclipse Helios for a long time and really wanted to upgrade to Eclipse Juno, but I’ve had various problems with Juno and PHP configuring, so instead I rolled back a release to Eclipse Indigo.
The Zend package is a good one to use so you don’t need to fetch the PDT elsewhere and is packaged (unsurprisingly) in a way that works ‘out of the box’. So visit the Zend site for the Eclipse & PDT package and download the Eclipse Zend PDT .zip. Once that’s downloaded, extract it to somewhere like C:\…
When unzipping, Windows can seem to place your extracted contents inside another folder, since we’re looking to create
We want to unzip the contents into C:\ so select that as your destination.
Since Eclipse doesn’t ‘install’, if you want to create a shortcut, do so by right-clicking the eclipse-php.exe and following the creating a shortcut procedure.
Eclipse project setup
Now we want to integrate your existing Drupal structure with Eclipse. If you’ve not actually yet installed Drupal – follow this guide http://drupal.org/documentation/install but bear in mind that we don’t want to put our Drupal extraction into a htdocs or www type directory – since we’ve setup virtual hosts.
can have problems with associating content types to php syntax colouring in Eclipse Juno, …
used .. instead
install a plugin