Placeholder Image

Subtitles section Play video

  • So how do you learn about the environment?

  • You're PHP code is going be running in, especially if it's in a shared hosted environment.

  • So you're going to purchasing a server or purchasing some kind of shared hosting plan from a vendor while there's a function built into PHP called PHP info.

  • And if you run that function within a PHP script, you will get a report that shows you the environment that you're PHP code is writing in so that you have a better idea of what to expect and also know what configuration changes you may need to to d'oh.

  • So with that, let's go over to computer so I can show you how PHP ANFO works.

  • So this is a basic script in order to run a PHP info.

  • So we're going to do is we're going to use the opening PHP tag and then we're going to simply run the PHP Info function will talk about functions mawr in other videos, but basically type in PHP info, then open bracket close bracket.

  • This is for the function.

  • Then you do a semi colon and then we're going to close PHP and what you're going to get here is you're going to get a full report about the environment.

  • You're PHP code is running in from here.

  • We do file, then we're going to save.

  • And so we'll just call this PHP info dot PHP.

  • So remember that dot PHP as extension on, we're going to put this on the desktop.

  • Once we've saved this, we can see that it's sitting on the desktop now.

  • So then we go to our file manager for our Web server, and now we're going to upload that file simply choose file.

  • And they were going to PHP and foe, and it has now been uploaded.

  • So we have the index stop PHP and the peak p dot info.

  • So if we go over and we go to silicon dodo dot com, we're still going to the file.

  • That's index stop PHP.

  • So what we're going to do here as we're simply going to go to PHP info dot PHP in order to call the script.

  • And when we call the script, this is what we're going to get out of that PHP and faux function.

  • So if your brand new to PHP, a lot of this is going to be confusing the important thing to understand.

  • If you're running a script and and you're getting specific errors, or if you're going to be running a script that somebody else has given you or you've downloaded, you'll be told that there's certain parameters that need to be enabled or disabled in your environment.

  • And so you can come in here and you can take a look at that information so we can see for actual directory support where the PHP dot i and I file is located.

  • So this is something we'll talk about later.

  • The PHP dot i and I file is where all of these configurations air actually stored.

  • So if you need to try to access that, that would be there.

  • We can go through.

  • We can take a lot.

  • Look at a lot of the different information that's available.

  • Different variables that are turned on, turned off, whatever their their settings are.

  • And so all of this information will be given to you from this PHP info function.

  • So this is a very important function, understand, especially if you're gonna be using shared host environments so that you know what's going on with your PHP code.

  • That's all there is to the PHP info function.

  • How to create a basic script in order to call the PHP info function and how to upload it and use it for your Web server.

  • This is definitely a tool that you will use over the years because many, many times you're PHP script will simply not run or you'll have issues because of small configurations.

  • It's important, understand, Even if you write your PHP script 100% correct, there are no errors in your script.

  • If the configurations in the PHP dot i and I file are set in certain ways, your script may not run.

  • And so this is an issue that, especially a lot of new coders run into.

  • They think that their coding things improperly when in reality it's the configurations on their server that are causing them the issue.

So how do you learn about the environment?

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it