Difference between revisions of "Phpinfo page"

From TheBestLinux.com
Jump to navigation Jump to search
(Created page with "* Using the text editor of your choice(I prefer vi/vim, but newbies like pico), create a new file named phpinfo.php, or anything you want, as long as it ends with the .php fil...")
 
Line 13: Line 13:
 
<br /><br />
 
<br /><br />
 
I then hit the "ENTER" key, taking me into a blank page, as seen here:
 
I then hit the "ENTER" key, taking me into a blank page, as seen here:
 +
<pre style="color:blue">
  
 
~                                                                               
 
~                                                                               

Revision as of 11:06, 16 January 2021

  • Using the text editor of your choice(I prefer vi/vim, but newbies like pico), create a new file named phpinfo.php, or anything you want, as long as it ends with the .php filename extension, in the root directory of your web server. On Linux, that us usually /var/www/html. Within that file, enter these three lines of text:
<?php
phpinfo()
?>



Here's the scrollback of me doing it on one of my VM's:

[jamie@cos8vm8.dawgland.com:~]$ cd /var/www/html/
[jamie@cos8vm8.dawgland.com:/var/www/html]$ sudo vi phpinfo.php



I then hit the "ENTER" key, taking me into a blank page, as seen here:


~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
"phpinfo.php" [New File]

At this point, I'm in "command" mode, so I need to tap the "I" key to put me into "Insert" mode. Then, I can type in the 3 required lines:

<?php
phpinfo()
?>



I then need to get out of "Insert" mode within vi/vim, so I tap the "Escape" key to do that, taking me back to "command" mode(there is no prompt or notification you have changed modes - you just need to know what you are doing, which is why most newbies don't care much for VI/VIM!). Once back in "command" mode, most VI guys use the colon and then the "w" key to "write" the file, and the "q" key to quit VI, such as ":wq", without the quotes in my example. The beauty and power of VI is modern versions allow you to use ":x" without the quotes, to exit and save in one command, the "x" command! Here is the screenshot of me doing so:

<?php
phpinfo()
?>

~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
:x



Once saved, and as long as you've already installed and configured PHP to work with your web server, you can then check it out at http://your-website-address/phpinfo.php and you should see a page similar to this:


[jamie@cos8vm8.dawgland.com:/var/www/html]$