There are a lot of reasons people want to learn web development or web programming, maybe you want to build a web app, maybe you want to build a Facebook to earn your first bucket of gold, but the point is, you want to satisfy your curiosity, you have plenty of questions lingering in your head waiting to be answered:
- How does a website work at back-end (the server)?
- How is a website or web app developed?
- What are the key ingredients that we need to use to build the next Facebook?
Conventionally, people started out with HTML first, simply because people “just know” that HTML is how web pages are designed out, and tutorials are everywhere! Heck HTML is easy to learn!
But why not HTML first?
It does not answer your question nor satisfying your actual curiosity
After learning HTML, you still feel helpless, you still do not know how a real web site is built, how they work, what is the magical stuff behind them all. Simply said, learning HTML is not helping you to reach your destination fast enough. After all HTML is just markup, it’s just like highlighting a text book with marker pen, but there is not robotic hands (programming involved). HTML is not a programming language, it’s merely a markup.
It does nothing but one-way communication
Great! You have learned HTML! Now you can create static web pages, but that’s it.
HTML is one-way communication, whatever the coder writes, whatever the visitor reads. There is no interaction, there is no exchange of information going on. Again, learning HTML does pretty much nothing to your web development beginner life.
HTML is just a way to present data generated by the web server, creating HTML files manually will be proved to be unscalable, unmaintainable. Learn PHP will tell you how things can be 100x better.
It can be learned later on
Face it, HTML is the de facto front-end markup language of modern web, there is no way you will not bump into it. Since you are going to deal with it anyway, I suggest you to postpone your HTML learning, and learn something that actually does something instead.
A bigger picture
Now, if you have not start learning HTML yet, great, for those who are learning HTML, put down your pen for a moment and let’s think about the big picture.
Chances are, if you learn how to write HTML files and open it up in web browser, you are nowhere near learning how web sites actually work.
To serve a website, we need a server. A server is just like any other computer, but with a special program built in to serve the web (for example, WAMP, now install it). Usually in the realm of open source, we use Apache (Linux thingy) to do it, some Microsoft guys will use IIS, but that doesn’t matter.
The server takes request (URL) and process it. If the URL is requesting any other static files (that don’t need to be parsed and processed by server), the server will hand over the file as is, like typical HTML files.
If the URL is requesting a PHP file, the PHP file is parsed by PHP program, and output is generated. The output can be HTML, text files, images, sounds, in short any file type imaginable. Yes, PHP is one of the way we can pass instructions to a server for it to do stuff.
To store and read data systematically, we can attach a database onto it, for instance in WAMP, we have MySQL, a widely used open source database system. PHP + MySQL are super imba powerful combo, and they are over level 9000 once you realize what they can do!
Note: There are plenty of alternatives out there apart from PHP and MySQL, but for beginners’ sake, to reduce complexity, I will just use them as example. Alternatives of PHP include ASP.Net, Python, Ruby on Rails, Cold Fusion…
Why PHP is chosen
It’s easy to pick up
PHP may not be the best language, for again, for beginner’s sake, it’s great. Most servers out there support PHP by default, you don’t need to install extra stuffs for them to parse PHP files correctly. In most of the time, your codes will just work.
What does a simple PHP code look like?
<?php echo "Hello Guys. Two plus two equals to ".2+2; ?>
You may not understand a crap, doesn’t matter, I still recommend you to learn PHP more than HTML+CSS now.
It is widely adopted
A wide adoption is crucial to the learner, you can Google a solution easily, or when you ask for help in a group, helps come much easily.
Nowadays, the job demand for PHP programmers is soaring high, knowing PHP gives you a fair amount of advantage if you want to settle down for web development job.
PHP tutorials can be found easily, recently Codecademy starts PHP coding tutorials as well, I strongly suggest you to check it out. Other than that I have also used W3Schools, Tizag and PHP.Net itself for ultimate referencing.
It ACTUALLY answers your questions
Once you start walking deeper into PHP + MySQL tutorials, you will suddenly have a lightbulb in your head and you say “AHHA! So I can actually use these shits to build a Facebook! Zuckerberg you are screwed!” Congratulations! You got your long time mystery answered!
Learning PHP in the beginning will give you a much bigger picture than starting out with HTML. In fact when you are learning PHP, you will eventually learn HTML at the same time, there is no point dedicating time slots to HTML, because you are already learning them.
One Warning about Learning PHP in Codecademy
You will learn about the syntax of PHP, but you will never know how PHP website is setup in real life.
Remember I told you to install WAMP? It’s a server, a full-fledged working and running server right in your computer. You can host a real website in it, if you configure it right you can even let people from around the globe to access it.
You can learn how to write PHP codes in Codecademy, but soon or later you will need to learn how to deploy them in real server, real environment.
How to start?
Install WAMP first, for PHP people, if you want to know where to put your PHP files and how to use them, read this.
Read tutorials online to understand the basics, you can either follow the tutorial on W3Schools or do some exercises on Codecademy.
If you have any problem, do not hesitate to Google, or if you have some questions cannot be Googled, don’t be afraid to ask on programmer groups, or StackOverflow. But before asking, make sure you have done your homework, and ask smartly.
If you have seen the word “PHP framework” like CodeIgniter, CakePHP that promise to save your time while developing, don’t learn them yet, learn them only when you fully grasp the basics of PHP, or you will wreck will hard-learned PHP skills.
P/S: What I did that time
To be honest, I started out with PHP before HTML. After I watched “The Social Network”, I downloaded the Facemash clone and uploaded to my site, spending hours figuring out the MySQL and reading the codes, I learned a bit of PHP, then I started to mod it and wreck it. Eventually I seek help from resources like W3Schools and learned the basics.
And I think I did the right thing, HTML and CSS alone are not worth my time, I am a highly logical person, I belong to back-end. I have tried front-end development (HTML, CSS, JS) but it didn’t really fit me.