Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»How to Create and Access phpinfo() File

    How to Create and Access phpinfo() File

    By RahulJuly 29, 20202 Mins ReadUpdated:July 31, 2020

    The phpinfo() is the core function of PHP. It prints detailed information about the current stat and configuration of PHP on server. With the help of phpinfo, you can find the PHP version, modules and there version and configuration options.

    Advertisement

    This tutorial will help you to create a php script with phpinfo() function and access it.

    Pre-Requsities

    We assume you already have installed PHP and a Web server on your system.

    Create File with PHPINFO()

    You need to find default ducument root of your Web server. Also, you can use document root of any domain configured with the web server and pointed to it.

    In my case, I create a php script at below location:

    sudo vim /var/www/html/phpinfo.php
    

    Add below content to the file:

    1
    2
    3
    <?php
      phpinfo();
    ?>

    Save your file and close it.

    Next, you need to set proper permissions on your file to be accessible by your web server.

    sudo chmod 755 /var/www/html/phpinfo.php
    sudo chown www-data:www-data /var/www/html/phpinfo.php
    

    Change www-data with the username of your web server running with.

    Access PHPINFO() Script

    Your phpinfo script is ready to access. You can access above created file in a web brower with your server ip address or configured domain name.

    http://server-ip/phpinfo.php

    Createing phpinfo() function script
    Output of phpinfo() function

    PHP
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Error: EACCES: permission denied, scandir (Resolved)

    How To Install Python 3.11 on Ubuntu 22.04 / 20.04

    Installing PHP on Pop!_OS

    How to Install PHP 8.x on Pop!_OS

    View 1 Comment

    1 Comment

    1. Toto on February 16, 2021 5:24 am

      I am using CentOS 8. Can I do this and access it through hostname remotely?

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.