MEWBIES@: Facebook Twitter G+ YouTube DeviantArt Forum Wall
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██
█▌ - PHPINFO() - SAFER METHOD TO CHECK YOUR PHP INFORMATION - █▌
█▌ █▌
█ ▐▌
█ If you ever need to find out information about your PHP - version, what ▐▌
█ modules are installed and enabled, etc. The easiest way to do this is to ▐▌
█ create a tiny php file and upload it to your web-server, htdocs, open the ▐▌
█ file in a browser to view. ▐▌
█ ▐▌
█ The reason for this mini tutorial though is many fail to mention what a ▐▌
█ safety hazard this file can be to potential hackers, and a few ways to ▐▌
█ counteract this. This is my method: ▐▌
█ ▐▌
█ PHPINFO() VIA BROWSER: ▐▌
█ `````````````````````` ▐▌
█ 1. Open a text editor such as Notepad, paste this line in, replacing ▐▌
█ 123.456.78.90 with your own IP (not the server IP): ▐▌
█ <?php if ($_SERVER['REMOTE_ADDR']=='123.456.78.90') phpinfo(); ?> ▐▌
█ ▐▌
█ With your IP in this file it means that only connections from your IP can ▐▌
█ view this page. ▐▌
█ ▐▌
█ Note only, do not use this code, the standard code for this file is: ▐▌
█ <?php ▐▌
█ phpinfo(); ▐▌
█ ?> ▐▌
█ ▐▌
█ 2. Save this file with any inconspicuous name you like with a php ▐▌
█ extension e.g. wallpaper.php, or zxwufbljlk.php - do not save this file as ▐▌
█ the standard name 'phpinfo.php'. ▐▌
█ ▐▌
█ 3. Upload it to your web-server in any htdocs dir. Open the file in your ▐▌
█ browser, e.g. http://yoursite.com/wallpaper.php ▐▌
█ ▐▌
█ 4. Once you are finished viewing the information delete it from your ▐▌
█ web-server. It takes less than a minute to upload it again if you need to, ▐▌
█ so do NOT leave it on your web-server. ▐▌
█ You could even 'File/Save Page As' in your browser to view in your local ▐▌
█ box if you want to take your time. ▐▌
█ ▐▌
█ Here are some examples, from a quick google search, of what phpinfo.php ▐▌
█ looks like so you can view how much sensitive information they can contain ▐▌
█ HERE HERE HERE & HERE. ▐▌
█ ▐▌
█ 5. You can also protect it in your apache2.conf file if you need to keep ▐▌
█ this file on your server for an extended period, cmds in your shell: ▐▌
█ su ▐▌
█ pico /etc/apache2/apache2.conf ▐▌
█ ▐▌
█ Paste in the the lines below replacing '123.456.78.90' & '234.567.89.01' ▐▌
█ with the IPs you want to allow to access this file, and replace ▐▌
█ 'wallpaper.php' with the name of your file: ▐▌
█ # protected files ▐▌
█ <Files wallpaper.php> ▐▌
█ Order Deny,Allow ▐▌
█ Deny from all ▐▌
█ Allow from 123.456.78.90 ▐▌
█ Allow from 234.567.89.01 ▐▌
█ </Files> ▐▌
█ ▐▌
█ Restart apache and exit root: ▐▌
█ /etc/init.d/apache2 restart ▐▌
█ exit ▐▌
█ ▐▌
█ PHPINFO() VIA COMMAND LINE: ▐▌
█ ``````````````````````````` ▐▌
█ You can also view your PHP information in your shell's command line. ▐▌
█ Though it doesn't give you as much information as the method above does ▐▌
█ (such as headings etc) it might just be the information you need. ▐▌
█ ▐▌
█ For help: ▐▌
█ php -h ▐▌
█ ▐▌
█ To output PHP information to the screen: ▐▌
█ php -i ▐▌
█ or ▐▌
█ echo "<?php phpinfo()?>" | php ▐▌
█ ▐▌
█ Or to save the reply to a file, in an existing directory (named my_stuff): ▐▌
█ mkdir my_stuff ▐▌
█ php -i | php > 123/test2_php.txt ▐▌
█ or ▐▌
█ echo "<?php phpinfo()?>" | php > my_stuff/test_php.txt ▐▌
█ ▐▌
█ To view it: ▐▌
█ pico my_stuff/test_php.txt ▐▌
█ ▐▌
█ To search for a word hit your Ctrl + w key, type in the word to search ▐▌
█ for, hit your enter key. ▐▌
█ ▐▌
█ //---------------------------------------------------------------------- ▐▌
█ ▐▌
█ If you find mistakes, have suggestions, and or questions please post at ▐▌
█ mewbies forum HERE - thank you. ▐▌
█ ▐▌
█ Last update on 20 Mar '13 ▐▌
█ ▐▌
█▌ █▌
█▌ - mewbies.com - █▌
█▌ █▌
██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██