Quick 10-Step PHP FAQ for Beginners

QArea Expert by QArea Expert on May 6, 2014

Quick 10-Step PHP FAQ for Beginners
Reading Time: 2 minutes

When web development services are getting more complex to provide, developers usually turn to the PHP programming language.

Learning it from the very first is not an easy business. But here’s the top 10 issues PHP beginners usually face starting learning the language, and their immediate answers.

  • What is PHP?

This is a popular multi-purpose scripting language designed especially for web development and it’s possible to embed in HTML.

  • I’m looking for online documentation or tutorials for learning PHP.

For a start, try using Zend.com tutorials.

  • How to run PHP locally on PC?

To do that, you’ll need a web server installed on PC. The easy and working way to run PHP locally is to get the free XAMPP app from Apachefriends.org, install it on your PC and let it then install PHP, MySQL DBMS, phpMyAdmin together with Apache web server on your PC.

  • How to upload images and the like with PHP?

Htmlgoodies.com features a detailed tutorial for web developers called ‘Upload Images Using PHP’.

  • How to create a CMS by means of PHP?

This is a difficult one. It’ll be better to use one of the variety of open-source CMSs possible to get on the Internet. A range of good CMS choices is well presented on OpenSourceCMS.com.

  • While running the PHP script, an error is indicated in a certain line, but I can see no problem there.

Chances are PHP in that line could get badly confused and even give up, but this not necessarily means the root of your problem lies in that very line. When getting a message like this, you should examine the line and start going all the way back over your code to search any syntax errors. An editor equipped with syntax color-coding could help you with this a lot and let you see some significant errors quicker.

  • My script won’t work right I have no idea why.

Your problem is you can’t code defensively yet which is an important thing to do. To learn this, you should give up thinking that variables are always set just like you expect. Instead, check their values before going on to functions like empty() and isset(). Also it’s useful to learn the error handling functions PHP provides.

If you have a question on how to provide some web application development services with PHP, act as follows. First, check if there has already been a similar problem on the forum. If not, describe the problem to the forum members: tell about how it’s expected to work, what it actually does, what you tried to correct it, etc. It’s recommended to use built-in [php] tags around coded sections so that they are easy to read. Your questions should be accurate and brief.

  • How to write login-controlled web pages with PHP?

You can normally do this with PHP sessions and the database containing user login information for user login verification. When the login is successful, the session variable is set. Next, controlled pages are to check if this session variable is correctly set. If not, you should redirect the user to the login page.

  • How to send an email using PHP?

To cut a long story short, you should use the function mail(). To find more info about this, check, for instance, bokehman.com “Mime Mailer script”.