Search This Blog

Tuesday, June 5, 2012

phpinfo - how to create info file?

PHP Info


This file can help you to identify which php modules/extensions installed and enabled on your server.
This solution very simple.
Step 1.
Connect to the server through SSH and be sure you have root credentials.
Navigate to public_html directory.
cd /home/websiteuser/public_html
Step 2.
Create file.
nano phpinfo.php
Copy to the file code below:


<?php  
phpinfo(); 
?> 
Save and quit from file editor.
Step 3.
Let's check file permissions and owner.

root@server [/home/ websiteuser/public_html]# ls -l | grep phpinfo
-rw-------  1 root  root      24 Jun  5 13:34 phpinfo.php

As you see, owner of this file root, because we created this file under user root.
Change ownership:
chown websiteuser.websiteuser phpinfo.php
Change permissions:
chmod 644 phpinfo.php

Step 4.
Browse to this file from browser.
http://websiteuser.com/phpinfo.php

Now you see information page of apache & php. All modules and extensions.

eNj0Y!


1 comment:

  1. 2 things. First of all it's not secure to call "phpinfo" as "phpinfo.php". It contains very dangerous information about web server. Everybody will search for this file. Second thing, remember to remove this file after you found what you need.

    p.s: never ever work as root!

    ReplyDelete