Ollama PHP Web UI Clone
  • PHP 67.5%
  • JavaScript 21.9%
  • CSS 10.5%
Find a file
2025-11-23 17:06:00 +01:00
api Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
assets Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
data Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
includes Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
.gitignore Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
admin_logs.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
admin_users.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
change_password.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
check_database.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
config.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
forgot_password.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
index.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
install.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
install.sh Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
LICENSE Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
login.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
migrate_database.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
migrate_db.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
README.md Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
register.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
reset_password.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
settings.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
setup_2fa.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00
verify_2fa.php Initial commit: Ollama PHP Web UI Clone 2025-11-23 17:06:00 +01:00

🤖 Ollama PHP WebUI Clone

A secure, feature-rich web interface for Ollama AI models built with PHP. No Node.js required - just pure PHP with SQLite database for easy deployment.

Version PHP License

✨ Key Features

🔐 Advanced Security

  • Two-Factor Authentication (2FA) with QR code setup
  • Secure password management with strength requirements
  • Password reset via email with token-based system
  • Session timeout protection
  • Login attempt logging with IP tracking and user agent
  • User account status management (active/disabled)
  • Role-based access control (Admin/User)

💬 Chat Management

  • Multiple chat conversations with sidebar navigation
  • Message history persistence in SQLite database
  • File attachments support (documents, images, code files)
  • Real-time streaming responses
  • Markdown rendering with syntax highlighting
  • Code block formatting with Highlight.js

🌐 Flexible Model Access

  • Local Ollama server support with custom URL configuration
  • Ollama Cloud integration for cloud-based models
  • Dual-mode operation: Use local models OR cloud models
  • API key management for cloud services
  • Model selection interface with available models listing

👥 User Management (Admin)

  • User creation and deletion
  • Role assignment (User/Admin)
  • Account activation/deactivation
  • 2FA reset for users
  • Email management
  • User statistics dashboard

📊 Monitoring & Logging

  • Access logs with timestamps, IP addresses, and status
  • Login attempt tracking (success, failed, pending 2FA)
  • Filtering and search capabilities
  • Statistics dashboard with visual indicators
  • User activity monitoring

🛠️ Administration Tools

  • Database diagnostics page
  • Migration system for database updates
  • System information dashboard
  • Connection testing for Ollama servers
  • Configuration management interface

📋 Requirements

  • PHP 7.4 or higher
  • SQLite3 extension for PHP
  • cURL extension for PHP
  • JSON extension for PHP
  • Web server (Apache, Nginx, or PHP built-in server)

Optional:

  • Local Ollama installation (if not using cloud mode)
  • Mail server for password reset functionality

🚀 Quick Installation

1. Clone or Download

git clone https://github.com/yourusername/ollama-php-webui.git
cd ollama-php-webui

2. Set Permissions

chmod 755 data/
chmod 755 uploads/

3. Initial Setup

Open your browser and navigate to:

http://localhost/ollama-php-webui/install.php

4. First Login

  • Username: admin
  • Password: admin

⚠️ Important: Change the default password immediately after first login!

⚙️ Configuration

Local Ollama Server

  1. Navigate to Settings → General Configuration
  2. Enter your Ollama server URL (e.g., http://localhost:11434)
  3. Click Test Connection to verify
  4. Save settings

Ollama Cloud Mode

  1. Get your API key from ollama.com
  2. Navigate to Settings → Ollama Cloud Setup
  3. Enable cloud mode
  4. Enter your API key
  5. Save settings

The system will automatically detect available cloud models.

📁 Project Structure

ollama-php-webui/
├── api/                    # API endpoints
│   ├── auth.php           # Authentication
│   ├── chat.php           # Chat operations
│   ├── models.php         # Model management
│   └── upload.php         # File uploads
├── assets/
│   ├── css/
│   │   └── main.css       # Styling
│   └── js/
│       └── app.js         # Frontend logic
├── data/
│   ├── database.sqlite    # SQLite database
│   └── ollama_url.json    # Server configuration
├── includes/
│   ├── Auth.php           # Authentication class
│   ├── Database.php       # Database handler
│   ├── OllamaClient.php   # Ollama API client
│   ├── TwoFactorAuth.php  # 2FA implementation
│   └── CloudManager.php   # Cloud integration
├── uploads/               # User-uploaded files
├── vendor/                # Dependencies
├── admin_logs.php         # Access logs viewer
├── admin_users.php        # User management
├── change_password.php    # Password change
├── check_database.php     # DB diagnostics
├── config.php             # Configuration
├── forgot_password.php    # Password recovery
├── index.php              # Main chat interface
├── install.php            # Installation wizard
├── login.php              # Login page
├── register.php           # User registration
├── reset_password.php     # Password reset
├── settings.php           # Settings page
├── setup_2fa.php          # 2FA setup
└── verify_2fa.php         # 2FA verification

🗄️ Database Structure

The application uses SQLite with the following main tables:

  • users - User accounts with 2FA support
  • chats - Chat conversations
  • messages - Chat messages with file attachments
  • message_files - File attachment metadata
  • settings - Application settings
  • login_logs - Authentication logging
  • password_resets - Password reset tokens
  • two_factor_sessions - Temporary 2FA sessions

Database Migration

If you're upgrading from an older version:

php migrate_database.php

Or visit: http://localhost/ollama-php-webui/migrate_database.php

🔒 Security Features

Password Requirements

  • Minimum 8 characters
  • At least one uppercase letter
  • At least one lowercase letter
  • At least one number
  • Password strength indicator

Two-Factor Authentication

  1. Navigate to Settings → 2FA Authentication
  2. Scan QR code with authenticator app (Google Authenticator, Authy, etc.)
  3. Enter verification code
  4. 2FA is now active for your account

Session Management

  • Automatic session timeout (configurable)
  • Secure session handling
  • CSRF protection
  • Password verification for critical operations

👤 User Roles

Admin

  • Full system access
  • User management
  • View all access logs
  • System configuration
  • Database diagnostics

User

  • Personal chat access
  • Own message history
  • Personal settings
  • Own access logs only
  • Password change
  • 2FA management

📊 Admin Dashboard Features

User Management

  • Create/delete users
  • Enable/disable accounts
  • Assign admin roles
  • Reset user 2FA
  • View user statistics

Access Logs

  • Filter by username, status, date range
  • View IP addresses and user agents
  • Track login attempts (successful, failed, pending 2FA)
  • Export capabilities
  • Real-time statistics

Database Diagnostics

  • Table structure verification
  • Missing column detection
  • User count and role distribution
  • 2FA adoption statistics
  • System information display

🌐 API Endpoints

Authentication

  • POST /api/auth.php?action=login - User login
  • POST /api/auth.php?action=logout - User logout
  • POST /api/auth.php?action=verify_2fa - 2FA verification

Chat

  • GET /api/chat.php?action=list - List user chats
  • POST /api/chat.php?action=create - Create new chat
  • GET /api/chat.php?action=messages&chat_id=X - Get messages
  • POST /api/chat.php?action=send - Send message
  • DELETE /api/chat.php?action=delete&chat_id=X - Delete chat

Models

  • GET /api/models.php - Get available models
  • GET /api/models.php?cloud=1 - Get cloud models

Files

  • POST /api/upload.php - Upload file attachment
  • GET /api/download.php?id=X - Download file

🔧 Advanced Configuration

Custom Ollama URL

Edit data/ollama_url.json:

{
  "url": "http://your-ollama-server:11434"
}

Session Timeout

Edit config.php:

define('SESSION_TIMEOUT', 3600); // seconds

Cloud Configuration

Stored in database settings table:

  • cloud_enabled - Enable/disable cloud mode
  • ollama_api_key - Your Ollama cloud API key

🎨 Customization

Themes

The application uses CSS custom properties for easy theming. Edit assets/css/main.css:

:root {
    --sidebar-bg: #171717;
    --main-bg: #0d0d0d;
    --message-text: #ffffff;
    --accent-color: #10a37f;
    /* ... more variables ... */
}

Branding

Change application name in config.php:

define('APP_NAME', 'Your Custom Name');
define('APP_VERSION', '1.0.0');

🐛 Troubleshooting

Database Issues

Visit the diagnostic page:

http://localhost/ollama-php-webui/check_database.php

Connection Problems

  1. Test local Ollama: Settings → Test Local Connection
  2. Check Ollama is running: ollama serve
  3. Verify URL configuration
  4. Check firewall settings

Permission Errors

chmod 755 data/
chmod 666 data/database.sqlite
chmod 755 uploads/

2FA Issues

Admins can reset user 2FA from the User Management page.

📝 Usage Tips

File Attachments

  • Supported: Documents, images, code files
  • Maximum size configurable in upload.php
  • Files stored in uploads/ directory
  • Linked to specific messages

Chat Organization

  • Create separate chats for different topics
  • Rename chats for better organization
  • Delete old chats to maintain performance
  • Export/backup important conversations

Performance

  • SQLite performs well for < 10 simultaneous users
  • For larger deployments, consider MySQL migration
  • Regular database maintenance recommended
  • Monitor uploads/ directory size

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Ollama team for the amazing AI platform
  • PHP community for robust libraries
  • Contributors and testers

📞 Support

🗺️ Roadmap

  • MySQL/PostgreSQL support
  • Multi-language interface
  • Advanced chat export (PDF, Markdown)
  • Plugin system
  • API rate limiting
  • Conversation sharing
  • Mobile app companion
  • Docker container
  • Kubernetes deployment guides

Made with ❤️ for the Ollama community

Last updated: November 2025