Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now

Configuring PHP


PHP with MySQL Essential Training

with Kevin Skoglund

Video: Configuring PHP

In this movie, we're going to configure PHP to the settings that we like and we need for this tutorial. Three things that we're going to be looking at, error reporting, output buffering, and timezone. Those are the three areas that we want to address. In the last movie, I showed you how to get the PHP info page. You do that from your WAMPSERVER menu, and you choose local host and that will take you to the main WAMPSERVER page, and then phpinfo is a link down here that will actually take you to it. So once you're on that page, this has all the information about the way in which php is configured.
Expand all | Collapse all
  1. 4m 8s
    1. Welcome
      1m 0s
    2. Using the exercise files
      3m 8s
  2. 15m 6s
    1. What is PHP?
      3m 52s
    2. The history of PHP
      2m 51s
    3. Why choose PHP?
      4m 10s
    4. Installation overview
      4m 13s
  3. 1h 3m
    1. Overview
      2m 33s
    2. Working with Apache Web Server
      6m 56s
    3. Changing the document root
      7m 24s
    4. Installing to Yosemite
      8m 13s
    5. Enabling PHP
      6m 16s
    6. Upgrading PHP
      3m 30s
    7. Configuring PHP
      10m 3s
    8. Installing MySQL
      5m 46s
    9. Configuring MySQL
      7m 24s
    10. Text editor
      5m 1s
  4. 31m 25s
    1. Overview
      3m 27s
    2. Installing WampServer
      5m 46s
    3. Finding the document root
      2m 24s
    4. Configuring PHP
      8m 12s
    5. Configuring MySQL
      5m 45s
    6. Text editor
      5m 51s
  5. 19m 12s
    1. Embedding PHP code on a page
      6m 43s
    2. Outputting dynamic text
      5m 55s
    3. The operational trail
      2m 27s
    4. Inserting code comments
      4m 7s
  6. 1h 18m
    1. Variables
      7m 50s
    2. Strings
      4m 38s
    3. String functions
      8m 54s
    4. Numbers part one: Integers
      6m 27s
    5. Numbers part two: Floating points
      5m 25s
    6. Arrays
      10m 0s
    7. Associative arrays
      6m 37s
    8. Array functions
      6m 33s
    9. Booleans
      3m 50s
    10. NULL and empty
      5m 15s
    11. Type juggling and casting
      8m 27s
    12. Constants
      4m 43s
  7. 27m 37s
    1. If statements
      6m 0s
    2. Else and elseif statements
      4m 16s
    3. Logical operators
      7m 30s
    4. Switch statements
      9m 51s
  8. 42m 15s
    1. While loops
      8m 41s
    2. For loops
      5m 59s
    3. Foreach loops
      8m 16s
    4. Continue
      8m 28s
    5. Break
      4m 8s
    6. Understanding array pointers
      6m 43s
  9. 37m 25s
    1. Defining functions
      8m 25s
    2. Function arguments
      5m 32s
    3. Returning values from a function
      7m 33s
    4. Multiple return values
      4m 53s
    5. Scope and global variables
      6m 2s
    6. Setting default argument values
      5m 0s
  10. 20m 18s
    1. Common problems
      3m 47s
    2. Warnings and errors
      8m 36s
    3. Debugging and troubleshooting
      7m 55s
  11. 57m 57s
    1. Links and URLs
      5m 33s
    2. Using GET values
      5m 35s
    3. Encoding GET values
      8m 41s
    4. Encoding for HTML
      9m 26s
    5. Including and requiring files
      7m 40s
    6. Modifying headers
      6m 45s
    7. Page redirection
      6m 43s
    8. Output buffering
      7m 34s
  12. 1h 3m
    1. Building forms
      7m 28s
    2. Detecting form submissions
      5m 59s
    3. Single-page form processing
      7m 57s
    4. Validating form values
      10m 40s
    5. Problems with validation logic
      9m 54s
    6. Displaying validation errors
      7m 23s
    7. Custom validation functions
      6m 28s
    8. Single-page form with validations
      7m 25s
  13. 28m 5s
    1. Working with cookies
      2m 49s
    2. Setting cookie values
      5m 55s
    3. Reading cookie values
      6m 1s
    4. Unsetting cookie values
      4m 51s
    5. Working with sessions
      8m 29s
  14. 48m 39s
    1. MySQL introduction
      6m 43s
    2. Creating a database
      7m 41s
    3. Creating a database table
      7m 42s
    4. CRUD in MySQL
      5m 48s
    5. Populating a MySQL database
      7m 32s
    6. Relational database tables
      6m 40s
    7. Populating the relational table
      6m 33s
  15. 56m 4s
    1. Database APIs in PHP
      4m 51s
    2. Connecting to MySQL with PHP
      7m 45s
    3. Retrieving data from MySQL
      8m 47s
    4. Working with retrieved data
      6m 12s
    5. Creating records with PHP
      6m 58s
    6. Updating and deleting records with PHP
      9m 6s
    7. SQL injection
      3m 5s
    8. Escaping strings for MySQL
      6m 45s
    9. Introducing prepared statements
      2m 35s
  16. 35m 58s
    1. Blueprinting the application
      7m 19s
    2. Building the CMS database
      5m 14s
    3. Establishing your work area
      4m 38s
    4. Creating and styling the first page
      4m 22s
    5. Making page assets reusable
      6m 36s
    6. Connecting the application to the database
      7m 49s
  17. 32m 49s
    1. Adding pages to the navigation subjects
      5m 58s
    2. Refactoring the navigation
      6m 7s
    3. Selecting pages from the navigation
      6m 2s
    4. Highlighting the current page
      5m 26s
    5. Moving the navigation to a function
      9m 16s
  18. 1h 45m
    1. Finding a subject in the database
      9m 48s
    2. Refactoring the page selection
      10m 52s
    3. Creating a new subject form
      6m 55s
    4. Processing form values and adding subjects
      11m 20s
    5. Passing data in the session
      9m 16s
    6. Validating form values
      9m 40s
    7. Creating an edit subject form
      8m 30s
    8. Using single-page submission
      7m 44s
    9. Deleting a subject
      9m 44s
    10. Cleaning up
      10m 37s
    11. Assignment: Pages CRUD
      4m 30s
    12. Assignment results: Pages CRUD
      6m 10s
  19. 39m 26s
    1. The public appearance
      8m 52s
    2. Using a context for conditional code
      11m 37s
    3. Adding a default subject behavior
      6m 9s
    4. The public content area
      5m 51s
    5. Protecting page visibility
      6m 57s
  20. 1h 3m
    1. User authentication overview
      4m 3s
    2. Admin CRUD
      8m 41s
    3. Encrypting passwords
      7m 26s
    4. Salting passwords
      5m 42s
    5. Adding password encryption to CMS
      11m 54s
    6. New PHP password functions
      3m 13s
    7. Creating a login system
      11m 28s
    8. Checking for authorization
      5m 48s
    9. Creating a logout page
      5m 40s
  21. 2m 4s
    1. Next steps
      2m 4s

please wait ...
PHP with MySQL Essential Training from
14h 24m Beginner Jun 04, 2013 Updated May 20, 2015

Viewers: in countries Watching now:

PHP is a popular, reliable programming language at the foundation of many smart, data-driven websites. This comprehensive course from Kevin Skoglund helps developers learn the basics of PHP (including variables, logical expressions, loops, and functions), understand how to connect PHP to a MySQL database, and gain experience developing a complete web application with site navigation, form validation, and a password-protected admin area. Kevin also covers the basic CRUD routines for updating a database, debugging techniques, and usable user interfaces. Along the way, he provides practical advice, offers examples of best practices, and demonstrates refactoring techniques to improve existing code.

Topics include:
  • What is PHP?
  • Installing and configuring PHP and MySQL
  • Exploring data types
  • Controlling code with logical expressions and loops
  • Using PHP's built-in functions
  • Writing custom functions
  • Building dynamic webpages
  • Working with forms and form data
  • Using cookies and sessions to store data
  • Connecting to MySQL with PHP
  • Creating and editing database records
  • Building a content management system
  • Adding user authentication
Kevin Skoglund

Configuring PHP

In this movie, we're going to configure PHP to the settings that we like and we need for this tutorial. Three things that we're going to be looking at, error reporting, output buffering, and timezone. Those are the three areas that we want to address. In the last movie, I showed you how to get the PHP info page. You do that from your WAMPSERVER menu, and you choose local host and that will take you to the main WAMPSERVER page, and then phpinfo is a link down here that will actually take you to it. So once you're on that page, this has all the information about the way in which php is configured.

So you can always come here if you want to see what is php running right now. What are its configuration options that it's using? This will tell you. The most important one of those is this one. Loaded configuration file. That tells us where the configuration file for PHP lives. It's called php.ini. Now WAMP also gives you a short cut so that you don't actually have to go directly there. You can just go to the WAMP menu and then under PHP you'll see there's an option for php.ini. Lets open that up now. Now it opens up in your default text editor.

For me right now, that's just Notepad that's built into Windows. And these are all the configuration options. Every line with a semi colon in front of it is a comment line. That means that it's not actually being processed. What's actually being processed are the lines that don't have semicolon the directives that are a little further down. So here, y2k_compliance equals on for example. Precision equals 14 for significant digits displayed at floating point numbers, and so on. Let's find the ones that we're interested in. I'll just do a search, and I can do that from the Edit and then I have Find or Control F you'll see also is what tells me will do it.

And then the first thing I want to find is display_ errors. And find the next occurrence to that. Now that's a commented outline, I'm not interested in that. Let's find the real one, and here it is down here. display_errors equals on. Now it also gives you some information on how to set this. And it typically gives you a development value and a production value. Development is what we're going to be doing on this computer locally. Production is when we actually deploy to a web server for the whole world to see and use. So we want to have different settings for those two things. For example with displaying errors, we want the errors to be on for us, so that we can see every single thing that goes wrong while we're building it. But when we put it in production, we don't want to to expose all of that data to our public.

We don't want to to tell them gobs and gobs of information about our code and about our set-up. So instead, we'll turn it off in that case. So you'll want to make sure that it's turned on for you and it should be. Now that's not the only setting related to errors, there are a couple more. The next one is error reporting, you can either search for it if you can't find it. For me, it's right above it here and let's just scroll up a little bit. Find out some of the information about that, and that tells you what all these different things are. And, why you would use them and gives you some common combinations that you might use.

Mine is set to report all errors. Now up until I think PHP 5.4. This said E_ALL and E_STRICT, which is what you can see is what it recommends up here. That E_STRICT is now included in E_ALL, so you don't have to do that anymore, but if you do, it's fine, it's just backwards compatible for older versions of PHP. Now when we're in production of course, we want to tell it not to do these and you put the little twiddle in front of it, the little tilde. So E_ALL and not the deprecations. Deprecations are code that's going to stop working in future versions. It works just fine right now, so there's no reason to bother the production server with it.

But as a developer, it's very important to see those deprecation, because it says hey, you're using something that's about to go out of date. You might want to think about a replacement for this soon, so make sure that you have either E_ALL or that you have E_ALL and this upright bar E_STRICT. Now if you're wondering, what is this weird E_ALL. It's actually a constant that represents a number. And if we just shoot back over here to our phpinfo page. Let's just do a find here real quick, for error reporting, and there it is.

And this is the number that it comes up with. But instead of trying to work with all the different numbers that correspond to these different things, those are settings of different bits. Instead we just use E_ALL. It's a lot more convenient. The next one I want us to look for in this same document is HTML errors. HTML errors, and here it is. You want to make sure that this is turned on. You would turn it off for production. But it basically says, when you create an error, do you want me to just give you text, or do you want me to put some HTML around the error as well? And It'll look better with the HTML around it, I think it looks a little nicer.

So, let's go ahead and do that. It also allows it to include HTML links in those errors, which can be handy. So that's it for errors. Now let's look at output buffering. That's a concept that we'll talk about later on. For now, I'll just try and find output_buffering. It says it can't find it, but I need to search up. It's probably up above. that's not the one I want. There it is. So, let's go up a little bit more. Now, my default setting is just to have it turned on. It says here that you can also provide a number that's the amount of bytes that it will allow to buffer, 4,096 is a default value.

That's what more people use. So, you could also just have 4,096 in here. However, we're going to alternate off right now. Alpha buffering is a desirable feature. It's something we're going to talk about, and we're going to learn why you would want to use it, but until you know about it, I want us to have it off. And then you'll appreciate it and understand oh that's what it does and that's why I need to use it. So, for now let's all make sure that alpha buffering is turned off. And then the next thing that we want to look at is the timezone. So again, let's do a search. We'll do search for timezone.

There it is right there, date.timezone equals and you might have empty quotes here, it might be commented out, or like me you might have UTC. UTC is Greenwich Mean Time. You can leave it at UTC and it'll work just fine. But you do need to set it to something and that's because if you don't set it then PHP is going to start giving you some errors from time to time saying hey, you're doing something that's related to date and time but you don't have a default time zone set.

That's not a good idea. So let's avoid those warnings by having some times zones set. Now I'm not in UTC so I'm going to go ahead and give it my time zone. On the website, you can find the list of those, And then I'm in America, so I'll click on America and you can scan down and you can find cities that are close to you. So maybe you're somewhere close to Denver, or you're close to Louisville, I'm actually going to be close to New York. So here it is for me. America, New_York.

So that's what I need to put in as my value. Has to be exactly like that. And I'm going to put it in quotes. It's going to be America/New_York. So that's going to be my timezone. And it will then use that as a default when it's working with dates. And most importantly, it'll get PHP to stop giving us warnings about it. So once you're done, you'll want to go to File and Save to save your changes, then you can close it. And then let's go back to WAMP. And let's Restart All Services. So that'll get all of those changes take effect.

It'll turn yellow briefly, red, yellow and then back to green. Now it's back online. Now if we go back here to our phpinfo page, scroll up to the top and reload the page. And then we can look for some of those changes to see if they took effect. The one that I'm most interested in is going to be Output Buffering. So let's see just see if we find that. Output and it has no value right now for it, which means that it's turned off. Let me look for my timezone, timezone. And you can see my default timezone now says America and New York.

So those are the three key configurations that you want to make sure that you set up before you start using PHP. There are plenty of other ones in there that you could set for yourself, but those are the ones that we really need to have before we move forward.

Find answers to the most frequently asked questions about PHP with MySQL Essential Training .

Expand all | Collapse all
please wait ...
Q: This course was revised on 6/4/2013. What changed?
A: The old version of this course was 6 years old and it was time for a complete revision, using PHP 5.4. (The tutorials will work with any version of PHP and covers any differences you might encounter). The author has also added updated installation instructions for Mac OS X Mountain Lion and Windows 8. The topics and end project are the same, but the code is slightly different. It also addresses frequently asked questions from the previous version.
Q: This course was updated on 5/20/2015. What changed?
A: We added one movie called "Changing the document root in Yosemite," which helps the Mac installation run more smoothly.
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Mark all as unwatched Cancel


You have completed PHP with MySQL Essential Training.

Return to your organization's learning portal to continue training, or close this page.


Upgrade to View Courses Offline


With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Start your FREE 10-day trial

Begin learning software, business, and creative skills—anytime,
anywhere—with video instruction from recognized industry experts. provides
Unlimited access to over 4,000 courses—more than 100,000 video tutorials
Expert-led instruction
On-the-go learning. Watch from your computer, tablet, or mobile device. Switch back and forth as you choose.
Start Your FREE Trial Now

A trusted source for knowledge.


We provide training to more than 4 million people, and our members tell us that helps them stay ahead of software updates, pick up brand-new skills, switch careers, land promotions, and explore new hobbies. What can we help you do?

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.