Knowing the version of PHP your server is running is crucial for compatibility and performance reasons, especially when working on web development projects. If your hosting platform doesn’t provide a built-in PHP Info feature, don’t worry! You can easily check the PHP version and other server information by creating a simple phpinfo file in your public_html directory. This blog will guide you through the steps.
Step 1: Access Your Public_HTML Directory
To get started, you’ll need access to your public_html files. Most hosting providers offer a file manager tool that you can use. In this guide, we’re using Hostinger’s File Manager as an example.
Step 2: Create a PHP Info File
Now that you’re in the public_html directory, it’s time to create the phpinfo file.
Step 3: Add PHP Code to the File
With your phpinfo.php file open in the text editor, you’ll need to insert a small piece of PHP code.
1. Copy and paste the following code into the text editor
phpinfo();
?>
2. Press Save to apply the changes.
This code triggers the PHP interpreter to output detailed information about the PHP environment on your server, including the version, configuration settings, and installed extensions.
Step 4: Access the PHP Info Page via Browser
Now that the phpinfo.php file is ready, you can view the PHP information directly through your web browser.
You should now see a detailed page displaying all the information about your server’s PHP configuration, including the version number at the top.
Alternative Method: Using an FTP Client
If you prefer using a text editor on your local machine or if your hosting provider doesn’t have a File Manager, you can create the phpinfo.php file on your computer and upload it to the public_html directory using an FTP client like FileZilla.
Once uploaded, you can access the file through your browser using the same steps mentioned earlier.
Conclusion
Creating a phpinfo file is a straightforward and effective way to check your PHP version and other configuration details directly from your browser. Whether you use your hosting platform’s file manager or an FTP client, this method provides a quick and reliable way to gather essential server information.
This entry was posted by Sasi and tagged in PHP Tutorial
No comments yet. Be the first to comment!