How to Enable utf8mb4 Support Using CloudLinux PHP Selector in cPanel

How to enable utf8mb4 support in PHP for proper emoji and international character display using CloudLinux PHP Selector.

Overview

This guide explains how to enable utf8mb4 support in your PHP configuration using the CloudLinux PHP Selector in cPanel. The utf8mb4 character set is essential for storing special characters, including emojis, international characters, and special symbols.

Why Enable utf8mb4?

Default UTF-8 Limitations

With standard UTF-8, you might encounter these issues:

  • Emojis appear as � or ????
  • Some special characters don't display correctly
  • Chinese, Japanese, or Korean characters may break
  • Database errors when storing certain characters

Benefits of utf8mb4

After enabling utf8mb4, you get:

  • Full emoji support in your content 😊 🎉 👍
  • Complete support for Chinese, Japanese, and Korean text
  • Proper handling of special characters and symbols
  • No more character storage errors
  • Better multilingual content support

Prerequisites

  • Access to your cPanel account

Step-by-Step Instructions

1. Access cPanel

  • Log in to your cPanel account
  • Use the credentials provided by WPCloud
Notion image

2. Locate PHP Selector

  1. Scroll to the "Software" section
  1. Look for "Select PHP Version" or "PHP Selector"
  1. Click to open the PHP configuration panel
Notion image

3. Select PHP Version

  • Choose your desired PHP version from the dropdown menu
  • Note: WPCloud recommends PHP 8.1 for optimal performance

4. Modify Extensions

Locate these critical extensions:

mysqli
pdo_mysql
nd_mysqli
nd_pdo_mysql

5. Disable Standard Extensions

Uncheck the boxes next to:

  • [❌] mysqli
  • [❌] pdo_mysql

6. Enable ND Extensions

Check the boxes next to:

  • [✓] nd_mysqli
  • [✓] nd_pdo_mysql

7. Save Configuration

  • Click "Save" or "Apply Changes"
  • Wait for the confirmation message

Verification Steps

After enabling utf8mb4 support, verify the changes:

  1. Check PHP Info
      • Create a test file named info.php
      • Add this code:
      <?php phpinfo(); ?>
      
      • Look for nd_mysqli and nd_pdo_mysql in the loaded extensions
  1. Test Character Support
      • Try adding emojis to your content
      • Test with international characters
      • Verify existing content displays correctly

Troubleshooting

Common Issues

  1. Website Errors After Change
      • Clear your browser cache
      • Clear PHP opcode cache
      • Verify all extensions are properly enabled
  1. Character Display Problems
      • Ensure proper HTML meta charset tags
      • Check database collation settings
      • Verify content encoding in your CMS settings

Reverting Changes

If you need to return to the original configuration:

  1. Access PHP Selector in cPanel
  1. Uncheck:
      • [❌] nd_mysqli
      • [❌] nd_pdo_mysql
  1. Check:
      • [✓] mysqli
      • [✓] pdo_mysql
  1. Save changes

Important Notes

  • This change affects PHP-MySQL interaction only
  • Database content remains unchanged
  • No data migration is required
  • Changes take effect immediately
  • Some applications may require additional configuration

When to Contact Support

Contact WPCloud support if you:

  • Experience persistent character display issues
  • Notice unusual character rendering
  • Need help with specific application configurations
  • Cannot access PHP Selector

Contact methods:

Best Practices After Changes

  1. Clear your site's cache
  1. Test by adding some emojis to a test post
  1. Check existing content with special characters

Remember: While enabling utf8mb4 support is generally safe, always ensure your applications are compatible with the new configuration. If you encounter any issues, WPCloud's support team is here to help.

Did this answer your question?
😞
😐
🤩

Last updated on November 13, 2024