Beginners PHP Articles
February 15, 2015
There are soooooooo many choices out there these days when it comes to writing PHP code. Here are just a few popular apps:
- Sublime Text – uber-nerds love this one!
- Dreamweaver – yes, it has a code editor too.
And there are many others, and I am not including the PHP IDE’s out there!
A PHP IDE (by the way,) is short for ‘Integrated Development Environment’. It is a code editor on steroids. They are much more powerful than standard code editors but they are also harder to learn. These days (2015) PHPStorm seems to one of the best, if not the best.
… The guys who created PHPStorm, created my favorite IDE for Java – IntelliJ IDEA. My nerd-servants are telling me PHPStorm is amazing. But, when teaching beginners how to program in PHP (or any other language,) it is best to not expose them to the added complexity of learning a full blown IDE. They can be very complex.
Back to code editors – so which is best?
In a nutshell: If I were teaching PHP, I would use either Sublime Text or Notepad++ if I was on Windows. Sublime Text works on both Mac and Windows but the license is ambiguous: it is free to demo but at some point you are supposed to pay the $70 for it. Not sure when though? I heard of some users still demoing it after 2 years!
This is a consideration for schools in terms of licensing. On the other hand, Notepad++ is free but it is Windows only.
Textwrangler is a Mac only HTML, CSS code editor but I don’t see you could use it for PHP.
Creator of Studioweb.com
April 30, 2014
The following details the steps you need to take to become a web developer – this is a question I get all the time by the way … you are not alone!
#1. Learn to code. You need the skills before you can sell them! Today (2014-2015) you need to learn the following technologies in this order:
- HTML5 & CSS3
- Twitter Bootstrap
- SQL & MySQL
- Object Oriented PHP (OOP in PHP)
To be clear, you don’t need to master all these before you get to step #2, #3 and so on … But you do need to see these as the ultimate goal.
… In fact, you could quickly move into step #2 once you have a good understanding of CSS and HTML under your belt. As you learn more though, you will be able to take on more jobs (simply because of the greater variety of skills you will have) and raise your pay/salary as you become more valuable and more experienced.
If you want to read the rest, download the pdf.
I hope you find this useful.
April 14, 2014
I am a big advocate of PHP but you have to ask yourself, how important is the choice of programming language, given so many great apps are created with many different languages? Think about it:
- Twitter – created with Ruby
- Facebook – created with PHP
- LinkedIn – created with Java
I get deeper into this topic in this video blog:
February 13, 2014
Anyone who reads my stuff knows that if I am anything, I am practical. So when it comes to learning (and teaching) programming to someone new to the whole programming game, for several pragmatic reasons, I think PHP by far is the best language to begin with. Here are some of the reasons:
- It is easy to learn.
- It is the most popular web scripting language.
- It is fast to program with.
Now, you can watch me yap about this in video for about 5 minutes – enjoy!
May 20, 2013
Not strictly PHP but something that any web programmer might have to deal with from time to time: denial-of-service attack (DoS attack).
What is a DOS attack?
Some dirty nerd (or group of dirty rat bastard nerds) decide they want to make your site or your servers unusable or at least, much less usable. What they do is flood the server with request in attempt to overload the CPU, memory and bandwidth.
… It just happend to me here on the killersites.com/killerphp.com servers. Some jerk-store using a microsoft server out of Washington, started flooding our PHP based forum with request … millions a day in fact! We have a fairly new dedicated server with multi-core processors, so we did not go down, but the server did get noticeably slower.
How did I discover it?
Besides noticing the server was acting a little sluggish (kinda like me after a few beers,) I popped open the web stats and noticed a huge amount of traffic from one IP address – that isolated source of big traffic pretty much tells you what you need to know.
How do you fix it?
Well, a good firewall is supposed to catch these things and block them … it seems my firewall falls asleep on the job sometimes, so in this case, I had to manually go in and ban the IP address. Once banned, any request from that IP are just dropped. This is not a perfect solution since the nefarious nerds can then just switch IP’s to continue the attack … but it seems to have done the trick this time.
Check out the chart below, showing the KillerSites server traffic flow, before and after I blocked the attacker’s IP:
May 3, 2013
Hey guys. My name is Roberto and I have been a web developer for the past five years. I will be blogging about interesting things in the life of a developer
I have worked with a few different frameworks over the course of my development career (e.g. CodeIgniter, Laravel, Symfony) and have also tried/tested many others. I always felt that frameworks are these perfect libraries of code that will make my life easy, and generally, that has been the case.
But over the last few months, I realized that frameworks are not perfect. Not even close. And although they do make annoying things like form validation or URI routing super easy, it seems that the simplest things can become buggy or complex.
No framework is perfect
Case and point: I have been working on a pretty decent sized project using CodeIgniter (my 4th project using this framework). CodeIgniter seems to be everyones “first”. The first framework where beginner PHP developers learn important skills like OOP and MVC.
But as I said, things are not perfect.
I kept getting some weird behaviour with PHP sessions, specifically when logging in and out in IE (insert IE insult here). It took me a few hours to solve the issue, mainly by partly rewriting some third party session library. But I felt it was really weird that something as simple as PHP sessions was broken (I mean there aren’t even that many PHP sessions functions)
So whats the point…
I basically have two main points:
- Frameworks are not perfect libraries of code that will make developing a breeze. They definitely do help (without a doubt), but dont be surprised to find bugs that will take you more than a few hours to fix.
- Saying that, fixing these bugs actually helps you become a better developer. It gets you to get into the smaller details and overall you learn much more about developing in PHP
When developing somewhat complicated web apps, I think using a framework is almost a must. Choosing a framework on the other hand…thats for another day.
For more discussion, you can find me on twitter here
June 3, 2012
Once you have an understanding of basic PHP concepts, the best way to develop your skills further, is to actually start building PHP applications – things that actually do something!
Fortunately, the Web has matured much in the last decade, and we now know what types of applications people are typically looking for – things like:
– shopping carts.
– log-in systems.
– content management systems.
With that in mind, we’ve put together a package that teaches you how to build these things, while teaching you more advanced PHP.
What’s really cool, is that once you’ve completed the project courses, not only will you have learned a lot about creating REAL PHP applications, you will have these applications that you can then use in your own projects, or your client’s projects. Check it out:
PHP Projects – Learn PHP by Building PHP Applications
February 15, 2011
I’ve been getting a lot of emails lately that are kinda like this:
Stef, I want to learn how to create apps for iPhones, iPads and Android devices … can you teach me!
Well the good news is that I am looking into this now. The bad news is that I don’t have anything ready … yet. That said, I do have some useful information and strategies for people who want to jump on this bandwagon quickly and easily.
Listen up …
iOS is for iPhones and iPads
That means you need to learn objective C … if you want to have total control over the iOS device. More on that later.
Google’s Android – on phones and tablets.
That means you need to learn a subset of Java (basically stripped down Java) if you want to have total control of the devices.
About objective C and Java
I don’t know much about objective C (but I’ve heard things …) but I do know a lot about Java. In both cases, many junior level PHP programmers might have a hard time with these languages because they require a deeper understanding of OOP.
The solution: HTML 5 and CSS3
The great thing about mobile applications, is that we expect that most of the time, they will be connected to the Internet – we assume that the apps will interact online at some point if not all the time.
This opens up the possibility of moving some of the heavy lifting over to the server where PHP can take care of biz for you. This MAY minimize the need to have to go down to the core of the device, forcing you to use Java or Objective C … depending on the device of course.
In the meantime, you can use HTML 5’s nifty new ability for local storage (of files,) to handle the times when a smart-phone is NOT online. How often does that happen …?
January 29, 2011
I recently got an email asking how to create password protected pages .. in an easy fast way for a beginner to PHP. From the email:
I was wondering if there is some premade script and setup for database I can utilize to get this up faster and still proceed to educate myself.
As any experience PHP nerd knows, there are several approaches one could take. But since this guy is new to PHP and programming, I decided on something simple:
December 6, 2010
Here’s some helpful info on a basic PHP system, from our Killersites Community Forum!
Basic PHP System: View, Edit, Add, Delete records with MySQLi
This is a revised version of my previous tutorial (http://www.killersit…eteadd-records/) which uses MySQLi rather than regular MySQL to connect to the database. MySQLi, often called MySQL Improved, has several advantages over regular MySQL, including support for prepared statements (which helps prevent SQL injection, a common security issue) and object-oriented code. I’ve also provided a modified view.php file that shows one way to do basic pagination.
I have also recorded a 8 part video tutorial (a bit over an an hour worth of video) showing how to build this system and explaining it as I go. It’s available in the KillerSites University (http://www.killersites.com/university – subscription required) under PHP > PHP CRUD Videos.
(Anyone with PHP knowledge is welcome to comment on the code. If there are issues I haven’t noticed, please let me know. Do realize that it is intended for beginners, so I didn’t want to do anything too advanced that might lead to confusion. Yes, I realize I could use OOP, or could separate some of these out into methods, etc. etc.)
OK… Here’s some code for you to play with. It’s a basic system that allows you to:
— view existing records
— edit existing records
— delete existing records
— add new records
Basically, just imagine that you are in charge of a sports team, and you want to keep a list of all your player’s contact information. The code I’ve created could be a starting point for that (it only includes fields for their first name/last name, but could obviously could be expanded to use more fields).
This is just a basic starting point for projects that require view/edit/delete functionality. I know it may seem a lot to understand at first, but read all the comments in the code — I try to explain what I am doing step by step. I’m also happy to help with any questions (please post questions in a new topic.)
How to create a system that allows a user to add/edit/remove data in a database seems to be a commonly asked topic, so I may adapt this into an actual tutorial at some point in the future.
— You’ll need to create a database (I named mine ‘records’ but it can be changed) using PHPMyAdmin
— Save the included sql file on your desktop as a .txt file
— Once you’ve created the database, make sure the database is selected, then click the “import” tab
— Select the .txt file on your desktop, and import it into your database. PHPMyAdmin will create all of the necessary tables/import some test data for you to play with
Written by: Ben
For the test data and the rest of the post, click here!