Common issues and solutions for the Upload and Shorten Advanced plugin.
Symptoms:
Solutions:
# Verify upload directory is writable
ls -la /path/to/yourls/user/plugins/YOURLS-Upload-and-Shorten-Advanced/uploads/
# Should show 755 or 777 permissions
# Fix permissions if needed
chmod -R 755 YOURLS-Upload-and-Shorten-Advanced/
chmod 777 YOURLS-Upload-and-Shorten-Advanced/uploads/
# Create if missing
mkdir -p /path/to/yourls/user/plugins/YOURLS-Upload-and-Shorten-Advanced/uploads/
chown www-data:www-data uploads/
Edit php.ini:
upload_max_filesize = 20M
post_max_size = 25M
max_execution_time = 300
memory_limit = 256M
Restart web server after changes:
systemctl restart apache2 # Apache
systemctl restart php-fpm # PHP-FPM
systemctl restart lsws # LiteSpeed
-- Check if tables exist
SHOW TABLES LIKE 'yourls_upload%';
-- Should show:
-- yourls_upload_files
-- yourls_upload_settings
If tables are missing, deactivate and reactivate the plugin.
Symptoms:
Solutions:
Verify file exists in upload directory:
ls -la /path/to/uploads/
Test direct access:
https://yourls.example.com/user/plugins/YOURLS-Upload-and-Shorten-Advanced/uploads/test.txt
If this doesn’t work, the directory isn’t web-accessible.
Verify .htaccess exists in uploads directory:
# Allow file access
<FilesMatch "\.(jpg|jpeg|png|gif|pdf|doc|docx|txt|zip)$">
Allow from all
</FilesMatch>
# Prevent PHP execution
<Files *.php>
deny from all
</Files>
Ensure YOURLS rewrite rules are working:
# Test with a regular YOURLS short URL first
curl -I https://yourls.example.com/test
If regular YOURLS URLs don’t work, fix YOURLS configuration first.
Symptoms:
Solutions:
Go to Admin Panel → Upload Settings:
Test with default YOURLS theme:
// In user/config.php, temporarily change theme
define('YOURLS_THEME', 'default');
If it works with default theme, your custom theme needs updates.
Open browser console (F12) and look for errors. Common issues:
Check that your theme includes the upload hook:
// Should be in your theme's index.php
yourls_do_action('upload_frontend_form');
Symptoms:
Solutions:
-- Check user permissions
SHOW GRANTS FOR 'yourls_user'@'localhost';
-- Should include:
-- CREATE, INSERT, UPDATE, DELETE, SELECT
If activation fails, create tables manually:
-- Run the SQL from sql/install.sql
SOURCE /path/to/YOURLS-Upload-and-Shorten-Advanced/sql/install.sql;
Verify YOURLS can connect:
// In a test file
require_once('/path/to/yourls/includes/load-yourls.php');
$db = yourls_get_db();
print_r($db);
// Deactivate plugin
// Then reactivate to trigger table creation
Symptoms:
Solutions:
# For standard web servers
chown -R www-data:www-data YOURLS-Upload-and-Shorten-Advanced/
# For CyberPanel
chown -R yourls_user:yourls_user YOURLS-Upload-and-Shorten-Advanced/
chown yourls_user:nobody YOURLS-Upload-and-Shorten-Advanced/
# Directories
find YOURLS-Upload-and-Shorten-Advanced/ -type d -exec chmod 755 {} \;
# Files
find YOURLS-Upload-and-Shorten-Advanced/ -type f -exec chmod 644 {} \;
# Uploads directory
chmod 777 YOURLS-Upload-and-Shorten-Advanced/uploads/
# Check if SELinux is enabled
getenforce
# If enforcing, add context
chcon -R -t httpd_sys_rw_content_t uploads/
# Or disable SELinux (not recommended for production)
setenforce 0
# Check AppArmor status
aa-status
# If blocking, adjust profile or disable for web server
Symptoms:
Solutions:
-- Clear rate limit table
DELETE FROM yourls_upload_rate_limits WHERE timestamp < DATE_SUB(NOW(), INTERVAL 1 HOUR);
In user/config.php:
define('UPLOAD_RATE_LIMIT', 20); // Increase limit
define('UPLOAD_RATE_WINDOW', 3600); // Adjust window
define('UPLOAD_RATE_LIMIT_WHITELIST', [
'YOUR.IP.ADDRESS.HERE',
]);
define('UPLOAD_RATE_LIMIT_ENABLED', false);
Enable debug mode to get detailed error information.
Add to user/config.php:
define('YOURLS_DEBUG', true);
define('UPLOAD_DEBUG', true);
View plugin logs:
tail -f /path/to/yourls/user/logs/upload-plugin.log
View PHP errors:
tail -f /var/log/php/error.log
# Or
tail -f /var/log/apache2/error.log
# Or
tail -f /var/log/nginx/error.log
// In user/config.php (temporarily)
error_reporting(E_ALL);
ini_set('display_errors', 1);
Create a test script:
<?php
// test-upload.php
require_once('includes/load-yourls.php');
$file = [
'name' => 'test.txt',
'type' => 'text/plain',
'tmp_name' => '/tmp/test.txt',
'size' => 100
];
$result = yourls_upload_file($file);
print_r($result);
Solutions:
max_execution_time = 600
max_input_time = 600
memory_limit = 512M
OPTIMIZE TABLE yourls_upload_files;
OPTIMIZE TABLE yourls_url;
define('UPLOAD_ENABLE_CACHE', true);
Solutions:
If you’re still experiencing issues:
Please gather this information:
Gather system information:
# PHP version
php -v
# Web server version
apache2 -v # or nginx -v, or /usr/local/lsws/bin/lshttpd -v
# Permissions
ls -la /path/to/YOURLS-Upload-and-Shorten-Advanced/
# Disk space
df -h
# PHP modules
php -m
# Recent errors
tail -50 /var/log/php/error.log