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

Linux Mint环境下PHP7.2无法安装mysqli扩展及登录页白屏求助

Hey there, let's work through your two linked issues— that frustrating blank login page and the missing mysqli extension on your Linux Mint LAMP stack (Apache2, MySQL 5.7, PHP 7.2). Here's how to tackle them step by step:

1. Troubleshooting the Blank Login Page

Blank pages after form submission almost always mean PHP is silently failing. First, let's force PHP to show errors so we can see exactly what's going wrong:

  • Find your PHP 7.2 config file for Apache: run php --ini and look for the "Loaded Configuration File" line (it'll probably be /etc/php/7.2/apache2/php.ini).
  • Edit the file with sudo privileges: sudo nano /etc/php/7.2/apache2/php.ini
  • Update these two key settings:
    display_errors = On
    error_reporting = E_ALL
    
  • Save the file (press Ctrl+O, then Enter) and exit (Ctrl+X), then restart Apache to apply changes: sudo systemctl restart apache2

Now reload your login page and submit it again—you should see an error message instead of a blank screen. The most likely culprit here is a failed database connection (since you're missing the mysqli extension), but let's also check a few other common pitfalls:

  • Ensure session_start(); is at the very top of your login script (before any HTML, whitespace, or echo statements)—missing this can break session-based login logic entirely.
  • If you're using header("Location: ..."); to redirect after login, double-check there's no output (even a single space) before this line. PHP can't send headers if content has already been sent to the browser, which often leads to blank pages.
2. Installing the mysqli Extension for PHP 7.2

Since Linux Mint is based on Ubuntu, the correct command to install the mysqli extension for PHP 7.2 is:

sudo apt update
sudo apt install php7.2-mysqli

After installation, restart Apache again to load the extension into the web server:

sudo systemctl restart apache2

To confirm the extension is installed and enabled:

  • Create a file named phpinfo.php in your web root (usually /var/www/html/) with this content:
    <?php phpinfo(); ?>
    
  • Visit http://192.168.xxx.xxx/phpinfo.php and search for "mysqli"—you should see a dedicated section with all the extension's settings if it's working.

If you get a "package not found" error during installation:

  • Make sure the Universe repository is enabled (it's required for most PHP extensions on Debian/Ubuntu-based systems):
    sudo add-apt-repository universe
    sudo apt update
    

Then try installing the extension again.

Once mysqli is active, go back to your login script and verify your database connection code—something like this should now work without errors:

$conn = mysqli_connect("localhost", "your_db_username", "your_db_password", "your_db_name");
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}

内容的提问来源于stack exchange,提问作者Jay Cho

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 09:01:51