We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How to safely view your phpinfo | Forum

dave Leader
dave May 26 '16
phpinfo officially referred to as phpinfo()  because it is a php function utility which returns information about your php configuration environment in a easy to read format. 


Here i a safe way to view your phpinfo.  


Just create a file in your site root (something that you can call from the browser)  such as http://www.example.com/whatever.php  and yes it has to have a .php extension on it.


Remember to call it something that no one could ever guess because it is a security issue if the public can view your php information.  And trust me there are people that troll domains looking for weaknesses such as when people call their files something generic like checkphp.php and the like. 


I used to have one called check_mysodacan_forflys_php.php  :) 


Anyway you get the point.   Now inside that file just put this code 


<?php


phpinfo();



and save the file... now call the file with your broswer and you will see the phpinfo displayed on your screen. 


do what you need to do as far as gathering the information that you need and then when you are done just comment out the phpinfo part of the file like so 


// phpinfo();



and save the file... this will prevent anyone that does access the file from seeing the phpinfo.  When you need the file again you can just un-comment the code and rerun the file from your browser. 


Or you can just delete the file and create a new one when you need one. But don't put it off because you will forget.  Comment out the code or delete the file right now, or a month from now you will find out that you forgot to do so.  


Hope this helps... 




The Forum post is edited by dave May 26 '16
dave Leader
dave May 26 '16
Now of course i have my oxwall site set up as a add on domain so i can create a file in the public_html and the preceding will work.  


However if your Oxwall site is in the public_html then you have two choices. Because oxwall will just go to the home page when you try to run the file.  This is because oxwall has not been told it is ok to run that file via your htaccess. 


So here are your choices: 


A.  You can forgo creating the file and just put the code inside your ow_includes/config.php file at the top like so 


<?php


phpinfo();

exit;


the reason you want the exit is because if you dont your site will load in the background and the phpinfo display will also look funky. And then run your site, remember to remove it of course when your done. 


B. You can tell Oxwall that it is OK to run this file from the browser by adding the file name to your htaccess file.  


Which you can do if you see here https://developers.oxwall.com/forum/topic/47116



Also remember that some control panels also have the phpinfo icon so you can view it right from your control panel without having to add any files or use any commands. 

The Forum post is edited by dave May 26 '16