Home
Username:
Password:
FileMaker 9 & PHP Foundations Tutorials

PHP Basics / Configuring PHP pt. 1

Subtitles of the Movie

In this lesson we're going to be talking to you about how to configure your PHP installation. Why would you want to do this? Well, as you've seen in previous lessons, whenever there's an error in your programming, PHP sends that error to the browser. You don't always want your errors going to the browser. Although it's helpful when you're developing, if other people see this information, it could be used to maliciously attack your server. Many of these errors contain the name of the script that's executing or the path on the web server where they reside. To suppress errors, you need to set the configuration directive display errors to off. By default, the FileMaker Pro 9 installation in PHP has display errors set to on. How do we know this? Well, let's go back to our PHP info function that we talked about in the earlier lesson. The PHP info function will output the current configuration settings for your PHP installation. I'm going to open up this file inside of a web browser so I can show you exactly what I'm talking about. Here's our PHP info output, which shows all the current configuration settings. These configuration settings are read from a specific file called the PHP.ini file, or referred to as PHP ini. Every PHP installation will have a PHP.ini file and in that file all the directives that are available are set for your PHP installation. Now, you can change these settings in one of two ways. First, you can actually open up this file and set the setting that you want. Then, when you restart your web server, PHP will load the new settings and your changes will take effect. Another way to change your PHP settings is to actually use the ini underscore set function inside of your PHP code, which will change the directives of your PHP configuration for that particular script that's running. I'm going to show you both examples so that you know how to make the changes that'll work best for you. First we'll start with the PHP ini file. Where is the PHP ini file located? It's different with every PHP installation, but the PHP info output will tell you exactly the path to your ini file. This particular installation was done by the FileMaker Server 9 installer. Because of that, it placed PHP inside the FileMaker Server folder under web publishing and then under a few other folders. I'm going to go ahead and open up this file using my text editor. Here's the PHP ini file. It doesn't contain any PHP code so I really don't want the highlighting, the syntax highlighting because it makes things look confusing. I'll set the language in my text editor to none so we get simple black and white output. Here are all the directives that are read into PHP when it starts up with the web server. Let's go back to our web page, which showed the PHP info. Remember, we talked about errors being sent to the browser? If I scroll down, I'll see a directive that says display errors is equal to on. Here we have the display errors directive and we know that it's set to on. If I go to my PHP configuration page, I can scroll down to where the error directives are placed, somewhere around the line 300. Here's my error handling and logging directives. PHP does a pretty good job explaining to you what the different directives do or mean. There are different types of error in PHP. You can specify which ones are outputted to the browser. Down here error reporting is equal to e all, which means that all errors and warnings, doesn't include e strict, will be outputted to the browser. Just below that we can see that display errors is equal to on. If I didn't way errors to be outputted to the browser, I would change this to off and then restart my web server. There are many directives in the PHP ini file. Some of those directives affect the core installation, while other control different aspects of the modules or libraries that have been compiled to give PHP extra abilities.

Tutorial Information

Course: FileMaker 9 & PHP Foundations
Author: Lance Hallberg
SKU: 33786
ISBN: 1-933736-99-2
Release Date: 2007-08-22
Duration: 9.5 hrs / 107 lessons
Work Files: Yes
Captions: For Online University members only
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 81,350 Video Tutorials (20,800 free)
  • Video Available as Flash or QuickTime
  • Over 782 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available