MagicServer is a lightweight and portable server package that includes Apache, PHP, MariaDB, and Redis, pre-configured to run MagicAppBuilder smoothly on Windows systems.
- β Portable β no installation required
- β Zero configuration
- β Auto-installs MagicAppBuilder
- β Rebuilds server configuration on each startup
- β
Includes:
- Apache 2.4.64
- PHP 8.4.10
- MariaDB 11.8.2
- Redis 5.0.14.1 (Windows build)
MagicServer/
βββ apache/ # Apache HTTP Server binaries and configuration files
βββ config/ # Generated config files (e.g., for Apache, PHP, Redis)
βββ data/ # MariaDB data directory (stores databases)
βββ logs/ # Central log directory (for Apache, MariaDB, Redis, etc.)
βββ mysql/ # MariaDB binaries and supporting files
βββ php/ # PHP runtime and configuration (php.ini, extensions)
βββ redis/ # Redis Server binaries and configuration
βββ sessions/ # PHP session file storage directory
βββ tmp/ # Temporary files (e.g., uploads, caches)
βββ www/ # Web root directory (place your web apps here)
β βββ __assets/ # Contains common asset files for the root index page
β βββ MagicAppBuilder/ # Auto-installed MagicAppBuilder (a low-code web platform)
β βββ phpmyadmin/ # Pre-installed phpMyAdmin for managing MariaDB databases
β βββ index.php # Index page for the www directory
βββ fn.php # Common/shared PHP utility functions
βββ install-magicappbuilder.php # Installer script for MagicAppBuilder platform
βββ install-mariadb.php # Script to initialize MariaDB system tables (data directory)
βββ set-mariadb-password.php # Script to set or change the MariaDB root password
βββ start.php # Script to generate config and start Apache, MariaDB, and Redis
βββ stop.php # Script to gracefully stop Apache, MariaDB, and RedisExtract MagicServer to any location, e.g.:
D:\MagicServer
Required to allow Apache, MariaDB, and Redis to run properly.
D:
cd MagicServerRun the following to install MariaDB:
php\php.exe install-mariadb.phpRun the following to download and install the latest version:
php\php.exe install-magicappbuilder.phpStarts Apache, MariaDB, Redis, and rebuilds configs:
php\php.exe start.phpOnce the server is up and running, it's important to set a secure password for the MariaDB root user.
To do this, run the following script:
php\php.exe set-mariadb-password.phpBy default, this script will set the root user's password to password. If you'd prefer to use a different password, you can modify the script beforehand by editing the following lines in the set-mariadb-password.php file:
$rootPassword = ''; // Current password. Leave empty if no password is set yet.
$newPassword = 'password'; // Desired new password.If you've already executed the script before changing the password, simply fill in the current password in the $rootPassword variable and re-run the script. This ensures the password update is applied correctly.
Tip: Always choose a strong, unique password for database root access to enhance security and prevent unauthorized access.
Open your browser and go to:
-
MagicAppBuilder:
http://localhost/MagicAppBuilder/ -
phpMyAdmin (MariaDB web interface):
http://localhost/phpmyadmin/
If you see the error "Login without a password is forbidden by configuration", set a MariaDB root password by running:
php\php.exe set-mariadb-password.php
To stop all services:
php\php.exe stop.phpTemplate-based configurations are rebuilt automatically.
| Component | Template File | Generated File |
|---|---|---|
| Apache | config/httpd-template.conf |
config/httpd.conf |
| PHP | config/php-template.ini |
php/php.ini |
| MariaDB | config/my-template.ini |
config/my.ini |
| Redis | config/redis-template.conf |
redis/redis.conf |
π Do not edit generated files. Modify the templates instead.
| Service | Username | Password |
|---|---|---|
| MariaDB | root |
password |
| MagicAppBuilder | administrator |
administrator |
| Your App | superuser |
superuser |
π Secure your environment by setting strong passwords.
To change the root password securely using phpMyAdmin:
-
Open http://localhost/phpmyadmin/ in your browser.
-
Log in with the default credentials:
- Username:
root - Password:
password
- Username:
-
Click the "User accounts" tab on the top menu.
-
Find the user
root@localhostand click "Edit privileges". -
Scroll to the "Change password" section.
-
Enter your new secure password twice, and click Go.
-
Repeat the same steps for any other
rootuser entries with a different Host name. -
After changing the password, you can log out and log in again using the new credentials.
β οΈ If you update the root password, make sure any application (including MagicAppBuilder) that connects to MariaDB is updated accordingly.
If youβve forgotten the MariaDB root password, you can reset it by following these steps. This method temporarily starts MariaDB in a special mode that does not require a password to log in.
-
Stop the Server (if itβs running)
Open Command Prompt and run the
stop.phpscript to make sure all services are stopped.php\php.exe stop.php
-
Open Command Prompt as Administrator
Make sure you are in the
MagicServerdirectory. -
Run MariaDB in Safe Mode
Run the following command to start MariaDB without access control checks. Keep this Command Prompt window open.
mysql\bin\mysqld.exe --skip-grant-tables --skip-networking
-
Open a New Command Prompt (as Administrator)
Open a second Command Prompt window and navigate back to the
MagicServerdirectory. -
Log In to MariaDB Without a Password
Type the following command to log in as
root:mysql\bin\mysql.exe -u root
-
Reset the Password
Once inside the MariaDB console, run the following SQL commands to set a new password. Replace
your_new_passwordwith the password you want.FLUSH PRIVILEGES; CREATE USER IF NOT EXISTS 'root'@'localhost' IDENTIFIED BY 'your_new_password'; CREATE USER IF NOT EXISTS 'root'@'127.0.0.1' IDENTIFIED BY 'your_new_password'; CREATE USER IF NOT EXISTS 'root'@'::1' IDENTIFIED BY 'your_new_password'; CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY 'your_new_password'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO 'root'@'::1' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES; QUIT;
-
Stop MariaDB Safe Mode
Close the first Command Prompt window (where you ran
mysqld.exe --skip-grant-tables). -
Restart the Server Normally
Now you can start all services again as usual.
php\php.exe start.php
Your root password has now been successfully reset.
If MariaDB fails to start, it might be due to corrupted data files, often caused by an improper shutdown (e.g., a system crash or closing the command window without running stop.php). You can attempt to recover your data by starting MariaDB in InnoDB's force recovery mode.
Warning: These steps are for emergency recovery. While this procedure can save your data, it's possible some recent transactions might be lost. Always back up your data regularly.
-
Stop All Services
Ensure all server components are fully stopped.
php\php.exe stop.php
-
Enable Force Recovery Mode
- Open the MariaDB configuration template:
config/my-template.ini. - Add the following line under the
[mysqld]section:innodb_force_recovery = 1 - Save the file. If MariaDB still fails to start in the next step, you can try increasing this value from 1 up to 6. Use the lowest value that allows the server to start.
- Open the MariaDB configuration template:
-
Start the Server in Recovery Mode
This command will regenerate the configuration and attempt to start MariaDB. In recovery mode, InnoDB tables will be read-only.
php\php.exe start.php
If MariaDB starts successfully, proceed immediately to the next step.
-
Backup Your Databases (Critical Step)
With the server running, you must export all your databases to SQL files.
- Go to phpMyAdmin at
http://localhost/phpmyadmin/. - For each of your important databases, select it, go to the "Export" tab, and click "Export" to save the
.sqlfile.
- Go to phpMyAdmin at
-
Clean Up and Re-initialize
Once you have backed up your data, you need to reset MariaDB to a clean state.
- Stop the server:
php\php.exe stop.php
- Remove the
innodb_force_recoveryline fromconfig/my-template.ini. - Delete the old, corrupt data directory:
data/mysql. - Re-initialize MariaDB to create a fresh data directory:
php\php.exe install-mariadb.php
- Stop the server:
-
Restart and Restore
- Start the server normally:
php\php.exe start.php
- Go back to phpMyAdmin, create new empty databases with the same names as before, and use the "Import" tab to restore your data from the
.sqlfiles you saved.
- Start the server normally:
Your MariaDB server should now be running with your data restored.
For enhanced security, it is highly recommended to set a password for your Redis server. By default, Redis is configured without a password.
-
Stop the Server
If the server is running, stop it first to prevent any issues.
php\php.exe stop.php
-
Edit the Redis Template
Open the Redis configuration template file located at
config/redis.windows-template.conf. -
Set the Password
Find the line
# requirepass foobared. Uncomment it (remove the#) and replacefoobaredwith your own strong, secure password.requirepass your_strong_password_here -
Restart the Server
Run the start script. This will regenerate
redis/redis.windows.conffrom the template and start the server with the new password requirement.php\php.exe start.php
-
Update Your Application
Don't forget to update the Redis configuration in your application (e.g., in MagicAppBuilder's configuration files) to include the new password, so it can connect to the Redis server.
- β Windows 10 and 11
- β PHP 7.x and 8.x supported
- β MagicAppBuilder v1.12.0+
- β Redis for Windows (Memurai / Microsoft port)
| Tool | Description | Path |
|---|---|---|
| PHP CLI | Run PHP scripts from the command line | php\php.exe |
| MariaDB CLI | MySQL-compatible database client | mysql\bin\mysql.exe |
| Redis CLI | Command-line interface for Redis | redis\redis-cli.exe |
| phpMyAdmin | Web-based interface for MariaDB administration | Accessible at /phpmyadmin/ in your browser |
Licensed under the MIT License, except for bundled components that use their respective open-source licenses.
MagicServer includes:
π‘ Happy building with MagicAppBuilder + Redis on MagicServer! π