Create a free account, or log in

How to start developing a web app using PHP

If you’re thinking about developing a web app for the first time, you’ve probably heard about a scripting language called “PHP”. So what does it do and how can you get started in it?   To find out, StartupSmart spoke to Melbourne PHP Users Group convenor Ben Dechrai. The group meets on the third Tuesday […]

If you’re thinking about developing a web app for the first time, you’ve probably heard about a scripting language called “PHP”. So what does it do and how can you get started in it?

 

To find out, StartupSmart spoke to Melbourne PHP Users Group convenor Ben Dechrai. The group meets on the third Tuesday of each month at coworking space Inspire9, with meetings including presentations and a lightning talk, followed by food and networking at a nearby eatery.

 

Dechrai explains PHP was a scripting language originally developed in the early ‘90s to add functionality to web pages.

 

“Since then, it’s grown to a fully-fledged programming language that powers some of the world’s most popular web sites, from Facebook and Digg to Wikipedia and every WordPress site in existence,” Dechrai says.

 

“It can also be used outside of the realm of web sites for pure data processing at the command line, and even as the code behind standalone desktop applications.”

 

Dechrai explains that, unlike mark-up language such as HTML or CSS, PHP code runs completely on the server, rather than your users’ browser.

 

“This allows you to keep sensitive information, such as database credentials, process of credit card information, behind curtains. PHP’s role is to determine what is sent to the browser as HTML, CSS and JavaScript. Even images can be controlled and generated in PHP,” he says.

 

“HTML, CSS and JavaScript are used to tell the browser what to display, how to style it, and how it should handle interactions with the site.”

 

PHP serves a similar role to other programming languages and frameworks, such as Ruby on Rails or Python. Dechrai explains that each language has its pros and cons.

 

“If you’re developing a web application that will be self-hosted by others, or that you want to be able to deploy with minimal fuss, PHP is the most widely supported web language, with 82% of all websites that report the language they use being built with PHP. Finding hosting for your application will be easier and, arguably, cheaper,” Dechrai says.

 

“PHP is also much easier to learn. This is a bit of a double edged sword, because its ease of use results in more insecure code being released, which I believe is the main reason PHP has had such a bad rap in the past.”

 

No matter what programming language you opt for, Dechrai warns “with any language, whether it’s PHP, C# or Cobol, it’s possible to create bugs.

 

“Some bugs are merely annoyances for users, like not allowing a ‘+’ sign in an email address. Some bugs can devastate the state of security on the whole internet, like the OpenSSL Heartbleed bug.

 

“Once you’re on your way to understanding PHP, and don’t need to refer to manuals every few minutes, start learning about web application security. A good book would be Chris Shiflett’s Essential PHP Security and the Open Web Application Security Project’s wiki has a wealth of information.”

 

Many popular content management systems, such as WordPress, Joomla or Drupal, are written in PHP. For startups using these CMSes, there are extra benefits to using PHP.

 

“There will always come a point at which the point-and-click interface and existing contributed libraries and modules will constrain your ability to provide the functionality you, your boss or your client desires. It’s at this point that you’ll need to delve in to the world of theming and module writing,” Dechrai says.

 

For those looking to get started, there are a number of good resources Dechrai recommends.

 

“I’ve always recommended Kevin Yank’s Build Your Own Database Driven Website Using PHP & MySQL. He’s recently released PHP & MySQL: Novice to Ninja, which has received great reviews,” he says.

 

“Sitepoint.com has some great articles and a supportive community forum. Most user groups will have an online community too, and the Melbourne PHP Users Group has a mailing list that members will post questions and requests for help to.

 

“If you prefer a proper tutorial setting, perhaps give something like NetTuts a try. I’ve never used them, so can’t vouch for the quality or value for money.

 

“Of course, there’s always the online manual, which comes complete with user contributed commentary. Looking for the manual page for a function? There’s a shortcut to it: Simply go to https://php.net/function_name, and you’ll be redirected to the right page.”

 

Dechrai’s final piece of advice for would-be developers is to just get started on their projects.

 

“It’s so easy to get a local development server up and running; MAMP, WAMP, and XAMPP are examples of simple installers that will give you a local Apache, MySql and PHP setup. The free versions are fine for anyone to start playing around,” Dechrai says.

 

“Once you have a local development environment, open your nearest PHP book or web page and start following a few examples. Tweak, change, hack and play. Wrangle the code to do your bidding, and go from there.”