Viewing PHP settings with the phpinfo() function
The phpinfo() function is a built‑in PHP command that outputs detailed information about the PHP environment. On ruachost.com, you can use this function to check PHP configuration settings, extensions, and server details.
Why Use phpinfo()?
Section titled “Why Use phpinfo()?”- Verify which PHP version your site is running.
- Check enabled extensions (e.g., MySQL, GD, cURL).
- Review configuration options such as memory limits, upload sizes, and timeouts.
- Troubleshoot compatibility issues with applications or frameworks.
How to Use phpinfo()
Section titled “How to Use phpinfo()”Step 1: Create a PHP File
Section titled “Step 1: Create a PHP File”- Log in to your hosting account via FTP, SFTP, or File Manager.
- Navigate to your site’s root directory (
public_html). - Create a new file named
info.php.
Step 2: Add the phpinfo() Function
Section titled “Step 2: Add the phpinfo() Function”Insert the following code into the file:
<?phpphpinfo();?>Step 3: Upload and Access the File
Section titled “Step 3: Upload and Access the File”-
Save the file.
-
Visit the file in your browser:
http://yourdomain.com/info.php -
A page will display detailed PHP configuration information.
Security Warning
Section titled “Security Warning”- The
phpinfo()output contains sensitive server details. - Do not leave the file accessible on a public site.
- Delete or rename the file after testing.
Example Output
Section titled “Example Output”When you run phpinfo(), you’ll see information such as:
- PHP version (e.g., 8.2.12)
- Loaded extensions (e.g., mysqli, gd, intl)
- Server API (e.g., Apache 2.0 Handler)
- Configuration directives (e.g.,
memory_limit,upload_max_filesize)