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

本地测试环境(Mamp Pro 4)与Ubuntu 16.04生产服务器兼容问题求助

Troubleshooting Plugin Issues on GCP Ubuntu 16.04 LAMP Stack

Hey there, let’s dig into why those plugins (including your WPS ones) are misbehaving on your GCP Compute Engine setup—even though everything works perfectly locally. I’ve helped folks fix this exact scenario dozens of times, so let’s break down the most likely culprits and actionable fixes:

1. File Permissions & Ownership Mismatch

Local environments often have looser permissions than production servers, and Apache on Ubuntu 16.04 runs as the www-data user/group. If your files are owned by your root user or another account, plugins can’t write to necessary directories (like uploads or cache).

  • First, check current permissions to confirm the issue:
    ls -l /var/www/html/
    
  • Fix the ownership to match Apache’s user:
    sudo chown -R www-data:www-data /var/www/html/
    
  • Set secure, functional permissions for files and directories:
    sudo find /var/www/html/ -type d -exec chmod 755 {} \;
    sudo find /var/www/html/ -type f -exec chmod 644 {} \;
    

Note: If specific plugins need write access to certain folders (like a media upload directory), you can adjust those individually instead of opening up permissions site-wide.

2. Missing PHP Extensions

Most WordPress plugins (especially WPS tools) rely on specific PHP extensions that might have been pre-installed on your local machine but are missing from your GCP server. Ubuntu 16.04’s default LAMP stack uses PHP 7.0, so let’s check and install the essentials:

  • List currently installed PHP extensions:
    php -m
    
  • Install common missing extensions that plugins depend on:
    sudo apt-get update
    sudo apt-get install php7.0-mysqli php7.0-curl php7.0-gd php7.0-xml php7.0-zip
    
  • Restart Apache to apply the changes:
    sudo systemctl restart apache2
    

3. PHP Configuration Limits

Plugins often fail if PHP’s memory, execution time, or file upload limits are too low. Let’s tweak these settings:

  • Open the Apache PHP config file (standard location for Ubuntu 16.04):
    sudo nano /etc/php/7.0/apache2/php.ini
    
  • Update these key parameters (adjust values as needed, but these are safe starting points):
    memory_limit = 256M
    max_execution_time = 300
    post_max_size = 64M
    upload_max_filesize = 64M
    
  • Save the file (Ctrl+O, then Enter) and exit nano (Ctrl+X), then restart Apache:
    sudo systemctl restart apache2
    

4. Apache Module or .htaccess Restrictions

Many plugins (especially those handling permalinks or redirects) require mod_rewrite to be enabled, and Apache needs permission to read .htaccess files.

  • Enable mod_rewrite if it’s not already active:
    sudo a2enmod rewrite
    sudo systemctl restart apache2
    
  • Allow Apache to use .htaccess by editing your site’s config file:
    sudo nano /etc/apache2/sites-available/000-default.conf
    
  • Find the <Directory /var/www/html/> block and change AllowOverride None to AllowOverride All:
    <Directory /var/www/html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    
  • Restart Apache again to apply this change.

5. Corrupted Plugin Files or Stale Cache

Sometimes the archive you downloaded via wget might be corrupted, or local cache might be causing conflicts on the server:

  • Delete the problematic plugin directories from /var/www/html/wp-content/plugins/ (replace plugin-name with the actual folder names):
    sudo rm -rf /var/www/html/wp-content/plugins/plugin-name/
    
  • Reinstall the plugins directly from the WordPress admin dashboard (if you have access) or download fresh copies from their official sources and upload them to the server.
  • Clear any site-wide cache (if you’re using a caching plugin) or manually delete the wp-content/cache directory if it exists.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 07:16:36