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

树莓派4上PhpMyAdmin主题图标无法加载求助

Hey there, let's tackle this phpMyAdmin icon/navigation issue you're facing on your Raspberry Pi 4 with Raspbian and Nginx. I've seen this exact problem a few times, so here are the most likely fixes to try:

1. Fix Nginx's Static File Routing for phpMyAdmin

The most common culprit is Nginx not properly serving phpMyAdmin's CSS, JS, and image files. You'll need to update your Nginx server block to include rules for these static assets.

Open your Nginx site config (usually at /etc/nginx/sites-available/your-site.conf) and add or adjust this location block for phpMyAdmin (adjust paths if you installed it elsewhere):

location /phpmyadmin {
    root /usr/share;
    index index.php index.html index.htm;

    # Handle PHP files
    location ~ ^/phpmyadmin/(.+\.php)$ {
        try_files $uri =404;
        root /usr/share;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Match your PHP version (e.g., php8.2-fpm.sock)
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    # Allow access to static assets
    location ~ ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        root /usr/share;
    }
}

After saving, restart Nginx to apply changes:

sudo systemctl restart nginx
2. Verify phpMyAdmin's Configuration File

Incorrect path settings in config.inc.php can break asset loading. Open your phpMyAdmin config file (typically /usr/share/phpmyadmin/config.inc.php):

  • If you know your phpMyAdmin full URL (e.g., http://your-pi-ip/phpmyadmin), add:
    $cfg['PmaAbsoluteUri'] = 'http://your-pi-ip/phpmyadmin/';
    
  • Alternatively, disable the URI warning (which can interfere with asset paths):
    $cfg['PmaAbsoluteUri_DisableWarning'] = true;
    

Save the file and refresh your browser.

3. Fix File Permissions (Ditch 777 for Secure, Correct Ownership)

Using 777 is insecure and often doesn't fix the root issue—Nginx needs proper ownership to read files. Run these commands to set the correct permissions:

sudo chown -R www-data:www-data /usr/share/phpmyadmin
sudo chmod -R 755 /usr/share/phpmyadmin

This gives Nginx's running user (www-data) read access while keeping files secure.

4. Install Missing PHP Extensions

phpMyAdmin relies on several PHP extensions to render icons and the navigation tree correctly. Install the required ones with:

sudo apt install php-gd php-mbstring php-zip php-json

Then restart PHP-FPM to load the new extensions:

sudo systemctl restart php7.4-fpm # Match your PHP version
5. Clear Browser Cache

Sometimes your browser caches corrupted static files. Force a hard refresh with Ctrl+Shift+R, or clear your browser's cache and cookies before revisiting phpMyAdmin.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.08 23:42:48