Top 10 Web Developer Questions About PHP

By Forum Member Web Developer

As a web developer begins to delve into more complex development tasks, PHP is often their chosen language of choice. We've put together a list of the top 10 questions asked about the PHP programming language to get you started!
  1. What is PHP?
  2. Is there online documentation and tutorials that can help me learn PHP?
  3. Can I run PHP locally on my PC?
  4. How do you upload images (or other files) using PHP?
  5. How can I create a CMS (Content Management System) with PHP?
  6. I get an error at line number X when I run my PHP script, but I don't see any problem on that line.
  7. My script isn't working right, but I can't figure out why.
  8. How can I ask a PHP question in a forum and get it answered?
  9. How can I use PHP to create login-controlled web pages?
  10. How do I send emails with PHP?

What is PHP?

PHP is a recursive acronym for "PHP: Hypertext Preprocessor". PHP is a widely-used general-purpose scripting language that is especially suited for web development and can be embedded into HTML. Much more info can be found at PHP.net.

Are there online documentation and tutorials that can help me learn PHP?

The manual is on-line here and is also available in other languages and downloadable versions.

For a beginner's tutorial on PHP, check out this Zend.com tutorial.

Can I run PHP locally on my PC?

Yes, but note that in addition to PHP you will need a web server running on your PC, too. A very convenient and effective way to do this is to download and install Apachefriends.org's XAMPP, which is an open-source program which will install PHP, Apache web server, MySQL DBMS, and phpMyAdmin onto your PC.

How do you upload images (or other files) using PHP?

We have put together a great tutorial with useful information and example code on this subject.

How can I create a CMS (Content Management System) with PHP?

This is not a trivial project (unless done very poorly and with little to no consideration for security). Consider using one of the many open-source CMS's which are available. OpenSourceCMS has lots of info on some of the many choices.

I get an error at line number X when I run my PHP script, but I don't see any problem on that line.

The line number in a PHP parse error message is the line where PHP "got too confused and gave up," but it's not necessarily the line where the root cause of the problem occurred. When you get such a message start looking at that line, then start working your way back through the code for various syntax errors (missing ";", unbalanced brackets or quotes, etc.) It is worth using an editor with PHP syntax color-coding to help you see some of these errors.

My script isn't working right, but I can't figure out why.

Learn to code defensively. Do not assume variables are set the way you think they should be; instead check their values before proceeding using functions like isset() and empty(). Learn to use PHP's error-handling functions.

How can I ask a PHP question in a forum like WebDeveloper.com or PHPBuilder.com and get it answered?

  1. Search. Click on search at the top of the forum and enter your term; the odds are someone will already have asked your question.
  2. Describe. Tell forum members what it should do, how it is to do it and what's wrong if you're getting an error. If you're unsure how to go about something then tell them what it should do and what you have already tried, this provides members with more info about what will and won't work.
  3. Use the forum's built in [php] tags around any and all coded sections (HTML as well as PHP). Your code will then be easier to read allowing forum members to be more accurate in their responses.
  4. Indent. I can't specify this enough, but often the problem could be a simple matter of a missing brace("{" or "}"); this is more common than you think.
  5. Ask a question. If you just give us information, no matter how accurate, unless forum members know what you want they cannot help you.
  6. If you have a script from a pre-made source, ask the author, they will properly know more about it than forum members.
  7. Cut down. Try to post only the relevant lines unless forum members ask for more. It ensures we will not be put off (and considering that forum members do this for free that's not the result you want) and can reply quicker.

How can I use PHP to create login-controlled web pages?

This is usually done by using PHP sessions in conjunction with a database. The database contains login information which is used to verify the user's login. Upon successful login, a session variable can be set. Controlled pages can then first check to see if this session variable exists and is properly set, and if not then redirect the user to the login page. Here is one article of many on the web on this subject.

How do I send emails with PHP?

Simply put, by using the mail() function. For more info, check out this article by Web Developer forum member Bokeh.

Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •  
  •  
  •  
Thanks for your registration, follow us on our social networks to keep up-to-date