Server Deployment
Deploy MilkAdmin to a web server using a packaged ZIP file and secure folder structure.
Creating a Deployment Package
Generate a ZIP package for faster server transfer. This creates a compressed archive ready for deployment.
php milkadmin/cli.php build-version zip
This command creates:
- A new version folder with all necessary files
- A ZIP archive containing
milkadmin,milkadmin_local, andpublic_htmlfolders - An
install_from_zip.phphelper script for server deployment
See the Installation / Update documentation for details on version building.
Folder Structure for Security
For security, only the public_html folder should be accessible from the web. The milkadmin and milkadmin_local folders must be placed outside the web server root.
Recommended Structure
/var/www/
├── milkadmin/ # Core framework (outside web root)
├── milkadmin_local/ # Local configurations (outside web root)
└── html/ # Web server root
└── public_html/ # Only this folder is web-accessible
├── index.php
└── milkadmin.php
milkadmin or milkadmin_local folders inside the web server root. This prevents direct access to core files and configurations.
Path Configuration
The public_html/milkadmin.php file contains path constants that reference the correct locations of milkadmin and milkadmin_local folders.
Available Constants
| Constant | Description |
|---|---|
MILK_DIR |
Absolute path to the milkadmin folder |
LOCAL_DIR |
Absolute path to the milkadmin_local folder |
Example Configuration
// public_html/milkadmin.php
if (!defined('MILK_DIR')) {
define('MILK_DIR', realpath(__DIR__."/../milkadmin"));
}
if (!defined('LOCAL_DIR')) {
define('LOCAL_DIR', realpath(__DIR__."/../milkadmin_local"));
}
After uploading to your server, verify and adjust these paths in milkadmin.php to match your server's directory structure.
Deployment Steps
1. Upload Files
Transfer the ZIP package and install script to your server:
- Upload the generated ZIP file
- Upload
install_from_zip.php
2. Extract Archive
Access install_from_zip.php via browser. The script will:
- Automatically extract the ZIP archive
- Redirect to the installation page
- Delete itself for security
Alternatively, manually extract the ZIP and ensure correct folder placement.
3. Configure Paths
Edit public_html/milkadmin.php to set correct paths for your server environment.
4. Install System
Navigate to public_html/index.php in your browser. The installation process will:
- Detect that the system needs installation
- Display the installation form
- Configure database and create necessary tables
- Complete the initial setup
Post-Installation
Backend Updates
Once installed, you can manage system updates and module installations from the backend admin panel at ?page=install.
Shell Updates (Modules Only)
Individual modules can be installed or updated via shell commands:
php milkadmin/cli.php {module_name}:install
php milkadmin/cli.php {module_name}:update
See Also
- Installation / Update - Complete installation system reference