You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

添加php.ini后my_phpinfo.php空白及Loaded Configuration File显示None求助

PHP配置问题:Loaded Configuration File显示None & 页面空白的解决方案

Let me break down what's going on here and walk you through fixing it step by step:

为什么“Loaded Configuration File”显示“None”?

When PHP starts up, it looks for the php.ini file in a specific order: first the path set during compilation, then the directory pointed to by the PHPRC environment variable, next system directories like your C:/Windows, and finally the PHP installation directory.

The "配置文件路径" you see in phpinfo is where PHP expects to find php.ini, but if there's no valid php.ini in that location, it will show "None". That's exactly what happened to you initially—there was no php.ini in C:/Windows, so PHP ran with its default built-in configuration instead of a custom one.

You don't need a "separate real php.ini" file!

The php.ini-development and php.ini-production files in your C:/PHP folder are official, valid configuration templates from PHP itself—they're not "fake" or incomplete. The only issue is their names don't match what PHP is looking for (php.ini).

Your earlier mistake was copying one of these files to C:/Windows and renaming it. This likely caused PHP to hit a parsing error or permission issue when loading the file, which is why your phpinfo page went blank (PHP often fails silently with configuration errors, resulting in an empty page).

Correct Steps to Fix This

  1. Undo your earlier misstep
    Delete the php.ini file you copied to C:/Windows to eliminate any conflicting configuration sources.

  2. Use the template in your PHP installation folder

    • Open your C:/PHP directory (where the php.ini-development and php.ini-production files live).
    • For a development environment (which sounds like what you're using), copy php.ini-development and rename the copy to php.ini. If this were a production server, you'd use php.ini-production instead—it disables debug features for better performance and security.
  3. Ensure PHP finds your new configuration file
    You have two reliable ways to do this:

    • Option 1: Set the PHPRC environment variable
      Right-click "This PC" → Properties → Advanced System Settings → Environment Variables. Under System Variables, create a new variable:
      • Variable name: PHPRC
      • Variable value: C:/PHP
        Save the changes, then restart your local server (the one running on localhost:4000). PHP will now look for php.ini in this directory first.
    • Option 2: Specify the config file when starting the built-in server
      If you're using PHP's built-in server (started with php -S localhost:4000), add the -c flag to point directly to your new config:
      php -S localhost:4000 -c "C:/PHP/php.ini"
      
  4. Verify the fix
    Restart your server, then reload localhost:4000/my_phpinfo.php. The "Loaded Configuration File" should now show C:/PHP/php.ini, and the page should display all the configuration details instead of being blank.

If the page is still blank...

Open your new php.ini file and find these settings:

display_errors = On
error_reporting = E_ALL

Set them to the values above, save the file, and restart your server. This will force PHP to display any errors that are causing the blank page, making it easy to troubleshoot remaining issues.

内容的提问来源于stack exchange,提问作者Yogesh Bhatt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 15:22:43