Let's talk about managing and administering your PHP installation. Remember that php is an application that runs alongside your web server. The two work hand in hand. PHP has a configuration file that determines how it runs. In other words there's some parameters that you can set to change the behavior of your php engine. This can affect things such as how long a PHP script will run. How much memory before it will max out. Or whether to display errors to your web browser. In order to change these settings you can go into that PHP File and change those directives and then restart your web server. Let's look at FileMaker's install of PHP and take a look at that PHP Configuration File. Go ahead and open up your file browser on your computer and locate your FileMaker Server Installation Folder. On the Mac OS X that's going to be in the Root Library Folder. And on a Windows machine it's going to be inside of your boot hard drive partition inside the Program Files and then FileMaker Folder. Inside FileMaker Server is the Web Publishing Folder and in there is the Publishing Engine Folder. Inside of that you'll see the PHP folder. Everything related to your PHP installation will be inside this PHP folder. Now on Mac OS X which is the system I'm using, there's a couple of different varieties of PHP. One for Lion and Snow Leopard. I'm going to click on Lion and go into my Lib Folder and here you can see the PHP.INI file. You might have to do some poking around but the file you're after is the one that's labeled PHP.INI, commonly referred to as the PHP INI file. I'm going to open this up in my code editor and here I have an explanation of what this file is, the syntax of the file. And then we have all the different directives. For instance if we look at Display Errors we can see that there's explanations of all the different types of errors and how they're handled. If I do Find on Display Error, I can move myself down the file until I get to the actual directive. Display errors is turned off, this is great for production because you don't errors being thrown about your dynamically generated HTML. Especially when those errors contain the full path to the file and where the error was thrown. That's a security risk so by default FileMaker's PHP installation has display errors turned off. However when you're testing your program and you're in Development Mode, you do want the errors turned on so that you can see where the problem is in your code. For example if you open up the 0204 Folder and you see that we have this file 0204.php with the Command This in it. That's not a valid command so it should be throwing an error. But when I load that into my browser, you'll see that I'm not getting an error, I'm getting a white blank page. That's because the error's suppressed because of my PHP.INI file, errors is turned off. What I would need to display those errors is turn this on and then save the file and then restart my web server. All these parameters or these directives are loaded when the web server starts up. So if you ever make changes you have to restart the web server. Now that being said make sure that you always make a backup copy of your PHP.INI file. Duplicate it and then work with the file, but if you ever make mistakes you can go back to your backup and then copy it and paste it back into your live PHP.INI File. Now let's say that you're in environment where you don't have access to the web server or the PHP.INI File. That's okay too because you can always change the directives on the fly using the PHP function called INI Set. So for instance rather than changing the directive here I could actually go into my code and I could say that I want to use INI Set and then all I need to do is put the name of the actual directive, I copied it and pasted it from the INI File and set it to true. Now if I refresh this page in my browser I'm getting the error outputted. So effectively while this script runs, display errors turned on. That's not a permanent change and it doesn't touch the INI File. It only affects the PHP operation for this one particular script. And then it's done. And then you might say well what are all directives and what are all they're values? I don't have access to my PHP.INI File. This is quite common if you have an environment where's there's an IT department that runs the web server. Or you're even using a web hosting company and you don't have access to the web server or the PHP engine and it's files. Well there's another special function called PHP Info and if you echo that function you can output the complete information and install information of your PHP installation. I went ahead and created this and I'll open it up in my browser and you can see that when you echo out the PHP Info, you get all the information related to your PHP install including all the configuration information. So if you wanted to know what the value was for the directive Display Errors you would simply do a find and you would see that Display Errors is turned off. And now you know you need to put that directive change inside of your PHP code. So this concludes how to manage and administer your PHP installation.
| Course: | FileMaker and PHP Foundations |
| Author: | Lance Hallberg |
| SKU: | 34393 |
| ISBN: | 978-1-61866-077-0 |
| Release Date: | 2012-12-07 |
| Duration: | 7.5 hrs / 97 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |