A friend of mine has been wanting to learn how to program for a while and now he's ready to take control of the code, starting with his existing WordPress site. I think that is a very smart decision and one more reason to finally write a short story about doing something like that.
Learning how to program makes a hell of a lot of sense. It's just smart. It actually means that you get to tell computers what to do and when to do it. We're gonna need a lot more of that in the very near future as it is much preferable to have machines do the hard work. Learning how to program means that you get to control the computer and I think that's particularly important given the current, completely uncontrolled and profitdriven, AI development. Honestly, I think it is fucking scary. So please, anyone, feel free to jump on the defence though knowledge wagon :-)
Within the current programming paradigm you may have to start by reflecting a little bit about what type of programming you want to do – because there are many genres with many different approaches, like Web, Application or Database, Compiled or Scripting, Object-Oriented or Procedural. Etc. or Etc. Yes, I understand if it seems like a jungle, but don't worry – so is life and you got this far :-) Some areas are more accessible than others and it is commonly seen that people enter in one area just to end up somewhere completely unexpected. So don't worry about starting off in the wrong direction – be more concerned with just getting started.
In my opinion web development has the lowest entry barrier and the largest community. Also probably the majority of selfmade developers has entered development through web development, such as myself, for that same reason. Last but not least, I wouldn't be the right person to write a guide on entering programming through any other area than through web development and thus, that should be enough reasons to start there.
The development tools are simple and possibly already on your computer. The complexity of the development process is also low – basically you only need a text editor and a browser. A slightly more advanced development environment would also consist of a webserver, a database and a serverside language of choice. My preferred stack flavour consists of TextMate, Firefox w/Firebug, Apache, MariaDB/MySQL and PHP.
It's all open source and doesn't cost a penny.
Setting up shop
In the following I will explain how to set up the simplest possible local environment to run a local website. You'll need a webserver, a database and a serverside language. My personal stack is of course designed for Janitor but it's also fully compatible with WordPress. However, Mamp or Wamp (Mac/Windows, Apache, MySQL, PHP) are very simple bundle installers and plenty enough to keep you going for a very long time.
Also, since this guide assumes you already have an existing website, you want to run locally, get a FTP-program, like cyberduck, or whatever you may have already been using for other purposes. Any FTP-program will do.
Create a “Sites" folder on the same level as Documents, Downloads, Pictures, etc. The folder could exist already, in that case that fits your purpose just fine as well. We're creating this folder, to have a distinct location for your development source code. In the future the Sites folder can contain more projects and this folder is now the root of your development environment.
Lets download your current website. Connect the FTP program to your current website host. When you log in, you might end up at the root of the server or directly in the website source code folder – it depends on the setup of the provider. If you see a bunch of .php files, you are likely in the project folder. If not, perhaps you see a folder named html, var or htmldocs? Then your website source code is likely in there. Look around until you find some .php clues.
Now download the folder containing your website to your local Sites folder. It's important that you download the parent folder, because there might be some required but invisible files in your project and because you want to keep the code contained.
Then open Mamp, go to settings and change the document root to the new folder in Sites, where your website is located.
Open a browser and type: http://localhost and if you have any luck, you'll see your website.
No comments yet