Setting up dev environement for WAMP developer
Obviously Linux based operating system are better suitable for Apache, MySQL and PHP development. But for some reason there are lots of developer who are still working on windows environment. But they always miss all the cool dev tools that are available in linux.
So those who are like me, who can’t move to linux and still using windows for php based web development – I’ll share my dev WAMP environment setup and workflow –
1. Setting up Linux, Apache, MySQL
No special recommendation about this… there are lots of solutions, package applications that you can use. I started my first development by setting up everything separately. Later started using easyphp, which was kind a cool because of the portability. You can copy your whole installation to any directory, computer and just run it. You can even run it from a pen drive!
Currently I’m using xampp – which is cool too.
The main thing is – there are lots of resources for this on online and most of you are already this setup ready. So you can keep your existing setup with it.
2. GIT
GIT is a must thing for developer. Most of you might already use it, those who don’t – you are missing a lots of features. Its not just version controlling system but it also comes with a cool console that I use everyday. This console is made from sygwin but much simpler and smaller.
If you didn’t use GIT before – you can learn it from the official website. There are well written documentation, books, videos. And there is a cool in browser learning place created by codeschool and Github – http://try.github.com/
Anyway – you can download the git from official website – http://git-scm.com/
During setup it there are few configuration options – but I just installed by tradition installation system – next, next, next :p
Repo hosting provider
Now you have GIT – but you need a remote repository. There are lots of service provider who provide GIT repo host. But I prefer mostly –
Bitbucket gives free unlimited private git repo hosting for max 5 member teams. That suits me pretty well 🙂
3. Console
As mentioned earlier – GIT will provide you a linux flavored console where you can write basic linux commands and programs like – ls, curl, vi (vim), ssh etc. Which is totally awesome as I feels like I’m working on a linux machine! It also comes with .bashrc so you can configure your console just like you do on linux.
a. .bashrc
.bashrc is a file that let you write custom features/configuration for your console. GIT console have this feature and you will find this file in ‘c:/Users/yourusername’. You will find a file called – ‘.bashrc’ and you can write all those custom function/configuration in this file. You can find lots of customization options online. But here are few that I use-
I. Sublime Text Alias:
alias sublime="/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"
You can open any file/directory on sublime text from the console. Basically you are adding a alias, which will save your time by typing just ‘sublime’ instead typing the whole path to the sublime text executable.
Use that code in your .bashrc and restart your console.
then you can open a directory by typing sublime . or a file by sublime filename.php. By default sublime will run into the console process, so you won’t be able to use console as long the sublime text will run. If you want to open sublime text in different process use sublime . & command.
ll. Fast Project Navigation function:
prj() { cd /e/work/www/$@ ;}
If you organize projects directory like me, putting all project directory in a single work directory, this feature will come real handy. This is basically a function which will also take input from the command and navigate to a project directory. So if you type prj projectdirname this will navigate to e:\work\www\projectdirname
folder. Replace /e/work/www/
with your project base directory and you are good to go.
b. Console2
Console2 is a Windows console window enhancement. Console features include: multiple tabs, text editor-like text selection, different background types, alpha and color-key transparency, configurable font, different window styles. It works great with GIT console if you pair them up together. Its an open source project and you can download it from here.
Once you have installed it, you can tweak around the settings and see different cool features that you always miss on windows. I already have done lots of tweaking and I love it. If you want you can use my configuration by just overwriting the configuration file – ‘console.xml’ in the same directory of the console2 executable.
<?xml version="1.0"?> <settings> <console change_refresh="10" refresh="100" rows="20" columns="87" buffer_rows="500" buffer_columns="0" shell="C:\Program Files\Git\bin\sh.exe --login -i" init_dir="E:\work\www" start_hidden="0" save_size="1"> <colors> <color id="0" r="0" g="43" b="54"/> <color id="1" r="38" g="139" b="210"/> <color id="2" r="133" g="153" b="0"/> <color id="3" r="42" g="161" b="152"/> <color id="4" r="220" g="50" b="47"/> <color id="5" r="211" g="54" b="130"/> <color id="6" r="181" g="137" b="0"/> <color id="7" r="238" g="232" b="213"/> <color id="8" r="128" g="128" b="128"/> <color id="9" r="131" g="148" b="150"/> <color id="10" r="88" g="110" b="117"/> <color id="11" r="147" g="161" b="161"/> <color id="12" r="203" g="75" b="22"/> <color id="13" r="108" g="113" b="196"/> <color id="14" r="101" g="123" b="131"/> <color id="15" r="255" g="255" b="255"/> </colors> </console> <appearance> <font name="Consolas" size="11" bold="0" italic="0" smoothing="2"> <color use="0" r="0" g="0" b="0"/> </font> <window title="Console" icon="" use_tab_icon="0" use_console_title="0" show_cmd="1" show_cmd_tabs="1" use_tab_title="1" trim_tab_titles="20" trim_tab_titles_right="0"/> <controls show_menu="0" show_toolbar="0" show_statusbar="0" show_tabs="1" hide_single_tab="1" show_scrollbars="1" flat_scrollbars="1" tabs_on_bottom="0"/> <styles caption="1" resizable="1" taskbar_button="1" border="1" inside_border="2" tray_icon="1"> <selection_color r="255" g="255" b="255"/> </styles> <position x="-1" y="-1" dock="-1" snap="-1" z_order="0" save_position="0"/> <transparency type="1" active_alpha="240" inactive_alpha="230" r="0" g="0" b="0"/> </appearance> <behavior> <copy_paste copy_on_select="1" clear_on_copy="1" no_wrap="1" trim_spaces="1" copy_newline_char="0" sensitive_copy="1"/> <scroll page_scroll_rows="0"/> <tab_highlight flashes="3" stay_highligted="1"/> </behavior> <hotkeys use_scroll_lock="1"> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="83" command="settings"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="112" command="help"/> <hotkey ctrl="0" shift="0" alt="1" extended="0" code="115" command="exit"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="84" command="newtab1"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="113" command="newtab2"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="114" command="newtab3"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="115" command="newtab4"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="116" command="newtab5"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="117" command="newtab6"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="118" command="newtab7"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="119" command="newtab8"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="120" command="newtab9"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="121" command="newtab10"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="49" command="switchtab1"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="50" command="switchtab2"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="51" command="switchtab3"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="52" command="switchtab4"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="53" command="switchtab5"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="54" command="switchtab6"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="55" command="switchtab7"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="56" command="switchtab8"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="57" command="switchtab9"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="48" command="switchtab10"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="9" command="nexttab"/> <hotkey ctrl="1" shift="1" alt="0" extended="0" code="9" command="prevtab"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="87" command="closetab"/> <hotkey ctrl="1" shift="0" alt="0" extended="0" code="82" command="renametab"/> <hotkey ctrl="1" shift="0" alt="0" extended="1" code="45" command="copy"/> <hotkey ctrl="1" shift="0" alt="0" extended="1" code="46" command="clear_selection"/> <hotkey ctrl="0" shift="1" alt="0" extended="1" code="45" command="paste"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="stopscroll"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollrowup"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollrowdown"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageup"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpagedown"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollcolleft"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollcolright"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageleft"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="scrollpageright"/> <hotkey ctrl="1" shift="1" alt="0" extended="0" code="112" command="dumpbuffer"/> <hotkey ctrl="0" shift="0" alt="0" extended="0" code="0" command="activate"/> </hotkeys> <mouse> <actions> <action ctrl="0" shift="1" alt="0" button="1" name="copy"/> <action ctrl="0" shift="0" alt="0" button="1" name="select"/> <action ctrl="0" shift="0" alt="0" button="2" name="paste"/> <action ctrl="1" shift="0" alt="0" button="1" name="drag"/> <action ctrl="0" shift="1" alt="0" button="2" name="menu"/> </actions> </mouse> <tabs> <tab title="Console2" use_default_icon="0"> <console shell="" init_dir="" run_as_user="0" user=""/> <cursor style="0" r="255" g="255" b="255"/> <background type="0" r="0" g="0" b="0"> <image file="" relative="0" extend="0" position="0"> <tint opacity="0" r="0" g="0" b="0"/> </image> </background> </tab> </tabs> </settings>
Note: Make sure you change shell at line 4 and init_dir at line 5 to correct path. shell is path to GIT console, so you will get all great features from GIT console. init_dir is where your console opens at startup. I used my working path so that I don’t have to always navigate to my work directory.
Tips:
- New Tab: For new tabs – just press ctrl+t.
- Copy/Paste: If you are familiar with the nightmare of default cmd copy/paste – you will love the the copy paste feature that I use. With above configuration you can copy by just marking the text and you are done! Yes, you just have to mark the text by dragging your mouse selection and it will automatically copy the selected text. Also if you want to paste any text – just right click on the console! Awesome!