Increase Upload PHP Limits
Role-based media upload limits with flexible PHP resource controls.
by ridhwanahsann · github.com/ridhwanahsan/increase-upload-php-limits · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/ridhwanahsan/increase-upload-php-limits/archive/refs/heads/main.zipRole-based media upload limits with flexible PHP resource controls and a clean, WordPress‑native UI.
Highlights
- Role‑based upload caps for Administrators, Editors, Authors, and others
- Runtime PHP limits via
ini_set()where available - Optional
.htaccesswriter (opt‑in) for hosts that block runtime overrides - Manual code generator for
.htaccessand.user.ini - Live server status with the effective WordPress upload limit
- Dashboard widget to quickly view current limits
- Context‑aware recommendations for WooCommerce/Elementor sites
Requirements
- WordPress 5.8+
- PHP 7.4+
Installation
- Upload the
increase-upload-php-limitsfolder to/wp-content/plugins/ - Activate via Plugins in the WordPress admin
- Go to “MediaBoost Settings” to configure limits
Quick Start
- Open “Increase Upload PHP Limits Settings”
- Set “Max Upload File Size” (presets: 64, 128, 228, 512, 1024, 2048 MB)
- Set “Max Post Size” to be equal to or larger than “Max Upload File Size”
- Save Changes
- If the Media screen still shows a lower limit, enable “Two‑in‑One Solution” to auto‑write
.htaccess, or use the Manual Code Generator to apply snippets manually
How It Works
- MediaBoost adjusts PHP limits at runtime using
ini_set()duringadmin_init. Not all hosts allow this. - If runtime changes are blocked, enable the optional
.htaccesswriter (Apache/mod_php) or copy the generated.htaccess/.user.inisnippets to your server. - The upload banner in Media uses the minimum of
upload_max_filesizeandpost_max_size. Ensure both are raised. - A role‑based filter enforces upload caps; for Administrators, the cap now follows the UI value. For Editors/Authors, caps apply but never exceed the UI limit.
Settings Overview
- Max Upload File Size: Controls per‑file limits in MB
- Max Post Size: Controls the total request size; must be ≥ upload size
- PHP Memory Limit: Memory available per request
- Max Execution Time: Script timeout in seconds
- Max Input Time: Input parsing timeout in seconds
- Max Input Vars: Maximum input variables accepted
- Two‑in‑One Solution: Opt‑in
.htaccessauto‑write if runtime is blocked - Opt‑in Usage Tracking: Anonymous usage data to help improve the plugin
Manual Code Generator
On the settings page, you’ll find:
.htaccessrules for Apache/mod_php.user.inirules for PHP‑FPM/FastCGI For Nginx, also setclient_max_body_sizein your Nginx configuration.
Troubleshooting
- The Media screen still shows 128 MB
- Set both “Max Upload File Size” and “Max Post Size” higher
- Enable “Two‑in‑One Solution” or copy
.htaccess/.user.inisnippets - On Nginx, configure
client_max_body_size
- Settings saved but values don’t change
- Your host likely enforces hard caps; use server‑level config via the manual snippets or contact hosting support
Security & Best Practices
- Settings are sanitized and clamped to safe ranges
- Capability and nonce checks on settings save
- Uses WordPress Filesystem API for controlled writes
- No eval, shell exec, or direct DB queries
Compatibility
- Recommends stronger defaults when WooCommerce or Elementor is active
- Works on standard WordPress admin flows without custom post types or editors
Development
- Text domain:
mediaboost - Translations are loaded on
plugins_loaded - Main plugin file:
mediaboost.php
FAQ
Does this edit server files?
Only if you enable the optional .htaccess auto‑write. Otherwise, it uses runtime configuration and provides manual snippets.
Is this safe for shared hosting?
Yes. All inputs are sanitized, access is limited to administrators, and server writes are opt‑in.
License
GPL‑2.0‑or‑later