Skip to content

Awan Server 3.0

Pre-release
Pre-release

Choose a tag to compare

@Royhtml Royhtml released this 02 Jun 12:30
· 41 commits to main since this release
096e38d

🚀 PHP Server Hosting Offline Lengkap (Pengganti XAMPP)

PHP Server

Solusi komprehensif untuk hosting PHP lokal dengan MySQL dan phpMyAdmin tanpa XAMPP - ringan, portabel, dan siap produksi!

🔍 Overview

Dokumen ini menjelaskan solusi server PHP offline yang 100% bisa menggantikan XAMPP dengan keunggulan:

  • Portabel: Bisa dijalankan dari flashdisk tanpa instalasi
  • Ringan: Hanya ~14MB (vs XAMPP ~500MB)
  • Kontrol penuh: Konfigurasi manual setiap komponen
  • Stabil: Tidak ada konflik port seperti XAMPP
  • Multi-versi: Bisa menjalankan PHP 5.6 sampai 8.3 sekaligus

🛠 Komponen Utama

Komponen Versi Fungsi Port Default
PHP 8.2 Engine PHP -
Apache 2.4 Web Server 8080
MySQL 8.0 Database 3306
phpMyAdmin 5.2 Admin MySQL -

📥 Instalasi Lengkap

1. Download Komponen

Unduh versi portable dari:

2. Struktur Folder

PHP_Server/
├── apache/          # Apache 2.4
│   ├── bin/
│   ├── conf/
│   └── modules/
├── php/             # PHP 8.2
│   ├── ext/
│   └── php.ini
├── mysql/           # MySQL 8.0
│   ├── bin/
│   ├── data/
│   └── my.ini
├── phpmyadmin/      # phpMyAdmin 5.2
├── htdocs/          # Folder project
└── start_server.bat # Script starter

3. Konfigurasi Apache (httpd.conf)

Define SRVROOT "C:/PHP_Server/apache"
ServerRoot "${SRVROOT}"
Listen 8080

LoadModule php_module "C:/PHP_Server/php/php8apache2_4.dll"
PHPIniDir "C:/PHP_Server/php"

<Directory "C:/PHP_Server/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

DocumentRoot "C:/PHP_Server/htdocs"
DirectoryIndex index.php index.html

4. Konfigurasi PHP (php.ini)

extension_dir = "C:\PHP_Server\php\ext"
enable_dl = On
cgi.force_redirect = 0
fastcgi.impersonate = 1
cgi.rfc2616_headers = 1

; Aktifkan ekstensi penting
extension=mysqli
extension=pdo_mysql
extension=gd
extension=mbstring
extension=openssl

upload_max_filesize = 16M
post_max_size = 16M
memory_limit = 128M

5. Konfigurasi MySQL (my.ini)

[mysqld]
basedir=C:/PHP_Server/mysql
datadir=C:/PHP_Server/mysql/data
port=3306
default_authentication_plugin=mysql_native_password

🚀 Script Starter (start_server.bat)

@echo off
title PHP Server Manager
color 0a

:: Set environment variables
set PHP_HOME=%~dp0php
set PATH=%PHP_HOME%;%PATH%

:: Start Apache
start "Apache" /D "%~dp0apache\bin" httpd.exe

:: Start MySQL
start "MySQL" /D "%~dp0mysql\bin" mysqld.exe --console

:: Wait for services to start
timeout /t 5 >nul

:: Open browser
start http://localhost:8080

echo Server started successfully!
echo Apache: http://localhost:8080
echo phpMyAdmin: http://localhost:8080/phpmyadmin
echo MySQL: localhost:3306
pause

🔒 Keamanan Tingkat Lanjut

1. Mengamankan phpMyAdmin

  1. Buat file .htaccess di folder phpMyAdmin:
AuthType Basic
AuthName "Restricted Area"
AuthUserFile "C:/PHP_Server/.htpasswd"
Require valid-user
  1. Buat password dengan htpasswd:
htpasswd -c "C:/PHP_Server/.htpasswd" admin

2. Mengamankan MySQL

-- Hapus user anonymous
DELETE FROM mysql.user WHERE User='';

-- Hapus akses root remote
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1');

-- Buat user khusus
CREATE USER 'dev'@'localhost' IDENTIFIED BY 'PasswordKuat123!';
GRANT ALL PRIVILEGES ON *.* TO 'dev'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES;

🔄 Multi-PHP Version

Untuk menjalankan beberapa versi PHP:

  1. Buat folder php5/, php7/, php8/
  2. Tambahkan di httpd.conf:
<IfModule !php_module>
    # PHP 8
    LoadModule php_module "C:/PHP_Server/php8/php8apache2_4.dll"
    PHPIniDir "C:/PHP_Server/php8"
</IfModule>

<IfModule php_module>
    <FilesMatch "\.php5$">
        SetHandler application/x-httpd-php5
    </FilesMatch>
</IfModule>

🌐 Sharing ke Jaringan

1. Konfigurasi Apache

Listen 192.168.1.100:8080
ServerName 192.168.1.100:8080
<Directory "C:/PHP_Server/htdocs">
    Require all granted
    Options Indexes FollowSymLinks
</Directory>

2. Aturan Firewall

New-NetFirewallRule -DisplayName "PHP Server" -Direction Inbound -LocalPort 8080 -Protocol TCP -Action Allow

🛠 Troubleshooting Komprehensif

Masalah Penyebab Solusi
Apache gagal start Port 8080 dipakai netstat -ano cari PID, lalu taskkill /PID xxxx /F
MySQL tidak jalan Port 3306 dipakai Ganti port di my.ini atau kosongkan port
phpMyAdmin error 500 Ekstensi PHP kurang Aktifkan mysqli, mbstring, openssl di php.ini
File PHP di-download Handler tidak terdaftar Pastikan di httpd.conf: AddHandler application/x-httpd-php .php
Akses ditolak Izin folder icacls "C:\PHP_Server" /grant Users:(OI)(CI)F

⚙️ Optimasi Performa

  1. OPCache untuk PHP (php.ini):
[opcache]
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
  1. Apache MPM (httpd.conf):
<IfModule mpm_prefork_module>
    StartServers        5
    MinSpareServers     5
    MaxSpareServers     10
    MaxRequestWorkers   150
    MaxConnectionsPerChild 0
</IfModule>

📦 Backup & Migrasi

  1. Backup database:
mysqldump -u root -p --all-databases > full_backup.sql
  1. Backup konfigurasi:
  • php.ini
  • httpd.conf
  • my.ini
  • Folder htdocs/
  1. Migrasi ke server lain:
  • Salin seluruh folder PHP_Server/
  • Jalankan start_server.bat

🎯 Perbandingan dengan XAMPP

Fitur Solusi Ini XAMPP
Portabilitas ✅ Bisa di flashdisk ❌ Perlu instalasi
Ukuran ~11MB ~500MB
Multi PHP ✅ Support ❌ Single version
Update Per komponen Paket lengkap
Performa Lebih ringan Lebih berat
Keamanan Lebih terkontrol Default kurang aman

🚀 Langkah Penggunaan Harian

  1. Start Server:

    • Jalankan start_server.bat sebagai admin
    • Otomatis buka browser di localhost:8080
  2. Develop:

    • Simpan file PHP di htdocs/
    • Akses via http://localhost:8080/project/
  3. Database:

    • Akses phpMyAdmin di http://localhost:8080/phpmyadmin
    • User: dev, Password: PasswordKuat123!
  4. Shutdown:

    • Tutup jendela command prompt
    • Atau buat stop_server.bat:
      taskkill /IM httpd.exe /F
      taskkill /IM mysqld.exe /F

📚 Referensi Tambahan

  1. PHP for Windows Builds
  2. Apache Lounge Binaries
  3. MySQL Community Server
  4. phpMyAdmin Documentation
  5. Apache HTTP Server Documentation

Dikembangkan dengan ❤️ oleh Dwi Bakti | GitHub | Website

Dokumen ini menyediakan solusi lengkap pengganti XAMPP dengan:
✔ Konfigurasi detail setiap komponen
✔ Skrip otomatisasi
✔ Keamanan tingkat lanjut
✔ Troubleshooting komprehensif
✔ Optimasi performa
✔ Backup dan migrasi

Siap digunakan untuk development hingga produksi skala kecil!