Difference between revisions of "Phpinfo page"
(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...") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
</pre> | </pre> | ||
<br /><br /> | <br /><br /> | ||
− | Here's the scrollback of me doing it on one of my VM's: | + | Here's the scrollback of me doing it on one of my VM's (Kind of a mini-tutorial on VI~!): |
<pre style="color:blue"> | <pre style="color:blue"> | ||
[jamie@cos8vm8.dawgland.com:~]$ cd /var/www/html/ | [jamie@cos8vm8.dawgland.com:~]$ cd /var/www/html/ | ||
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"> | ||
~ | ~ | ||
Line 38: | Line 39: | ||
"phpinfo.php" [New File] | "phpinfo.php" [New File] | ||
</pre> | </pre> | ||
− | 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: | + | At this point, I'm in Vi's "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: |
<pre style="color:blue"> | <pre style="color:blue"> | ||
<?php | <?php | ||
Line 45: | Line 46: | ||
</pre> | </pre> | ||
<br /><br /> | <br /><br /> | ||
− | I then need to get out of "Insert" mode within | + | I then need to get out of "Insert" mode within VI/VIM(VIM=Vi Improved), 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: |
<pre style="color:blue"> | <pre style="color:blue"> | ||
<?php | <?php | ||
Line 75: | Line 76: | ||
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: | 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: | ||
<br /> | <br /> | ||
+ | [[File:PHPINFO Screenshot.jpg|center|thumb|899x899px]] | ||
[jamie@cos8vm8.dawgland.com:/var/www/html]$ | [jamie@cos8vm8.dawgland.com:/var/www/html]$ |
Revision as of 10:24, 29 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 (Kind of a mini-tutorial on VI~!):
[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 Vi's "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(VIM=Vi Improved), 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]$