Problem Description
When installing or running WordPress in BT Panel (BaoTa), you may encounter errors due to missing PHP extensions. Common error messages include:
Call to undefined function mysqli_connect()Your PHP installation appears to be missing the MySQL extension which is required by WordPress- Errors indicating missing
mbstringoropensslextensions.
These errors are typically caused by the absence of core PHP extensions required by WordPress, especially when using PHP 8.x. This guide will show you how to quickly check and install the missing extensions via BT Panel.
Solution: Install Missing PHP Extensions
Follow these steps to install the necessary extensions for your PHP environment.
Step 1: Log into BT Panel and Access PHP Settings
- Log into your BT Panel backend.
- In the left navigation bar, find and click "Software Store".
- In the list of installed software, find the PHP version your website is using (e.g., PHP-8.0, PHP-8.1) and click its corresponding "Settings" button.
Step 2: Install Extension Modules
- On the PHP management page, click the "Install Extensions" tab at the top.
- In the extension list, find and select the core extensions required for WordPress. For most WordPress sites, the following are essential:
- mysqli or pdo_mysql: For connecting to the MySQL database (install one or both; both are recommended).
- fileinfo: For file type detection, required by many themes and plugins.
- opcache: PHP performance accelerator, recommended for installation.
- exif: For processing image metadata.
- mbstring: Multibyte string support, essential for handling non-English characters.
- openssl: For HTTPS secure connections and API communication.
- After selecting the required extensions, click the "Submit" button at the bottom. BT Panel will automatically download and compile these extensions.
- After installation, you must restart the PHP service. You can do this in the "Service" tab of the PHP management page or by returning to the BT Panel homepage, finding the PHP service, and clicking restart.
Step 3: Verify Successful Extension Installation
After installing and restarting, confirm the extensions are loaded.
- On the PHP management page, click the "Configuration File" tab.
- Use the search function (Ctrl+F) to search for
extension=and check if the relevant configuration lines are uncommented (no semicolon;at the beginning). BT Panel usually handles this automatically. - A more direct method is to create a PHP info file for verification:
- Via the BT Panel "Files" manager, navigate to your website's root directory (e.g.,
/www/wwwroot/yourdomain.com). - Create a new file named
phpinfo.php. - Edit the file and insert the code:
<?php phpinfo(); ?> - Save the file and access it via your browser at
https://yourdomain.com/phpinfo.php. - On the opened page, search for keywords like
mysqliormbstring. If the corresponding extension section exists, the installation was successful. - Important: After verification, be sure to delete the
phpinfo.phpfile to prevent server information leakage.
- Via the BT Panel "Files" manager, navigate to your website's root directory (e.g.,
Common Issues and Notes
- Extension Installation Fails: If errors occur during installation, it may be due to missing compilation dependencies or insufficient disk space. Check disk space in the BT Panel "Linux Toolbox" or install compilation tools via SSH with
yum install -y gcc gcc-c++ make(for CentOS) and try again. - WordPress Still Reports Errors: Ensure your website configuration (in BT Panel's "Websites" settings) is using the PHP version you just installed extensions for. Sometimes extensions are installed but the website still points to an old PHP version.
- Caching Issues: After restarting the PHP service, if the problem persists, try clearing WordPress cache, OPcache (if installed), and your browser cache.
- Extension Selection: Beyond the core extensions listed, you may need to install others like
imagick(image processing),zip, orgddepending on your theme or plugins. Install based on specific error messages.
Summary
To fix WordPress errors caused by missing PHP extensions in BT Panel, the core steps are: Locate the PHP version -> Install extensions -> Restart service -> Verify activation. Following the steps in this guide will quickly resolve most missing extension issues. Maintaining complete PHP extensions is fundamental for the stable operation of a WordPress site.