Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Sunday, 19 July 2026

Edit php nano untuk baris tertentu ke berapa

 Di nano, ada beberapa cara:

Cara 1 (paling cepat)

Tekan:

Ctrl + _ (Ctrl + Shift + - pada beberapa keyboard)

atau

Ctrl + / (tergantung layout keyboard).

Lalu akan muncul:

Enter line number, column number:

Ketik:

54

lalu tekan Enter.

Nano akan langsung melompat ke baris 54.


Cara 2 (lihat nomor baris)

Saat membuka file, tambahkan opsi -l:

nano -l form.php

atau

nano --linenumbers form.php

Sehingga nomor baris akan tampil di sebelah kiri.


Cara 3 (langsung buka di baris tertentu)

Jika file belum dibuka, bisa langsung:

nano +54 form.php

atau dengan path lengkap:

nano +54 /var/www/cms-sekolahku/app/Views/admin/news/form.php

Nano akan langsung membuka file pada baris 54.

Yang paling sering saya gunakan adalah Ctrl + _, ketik 54, lalu Enter.

Sinkron Waktu Posting dengan Waktu Lokal

 Kalau dirangkum, sebenarnya ada 2 perubahan konfigurasi yang akhirnya menyelesaikan masalah. Kita juga melakukan beberapa langkah investigasi untuk memastikan akar masalahnya.

Langkah investigasi

  1. ✅ Memastikan timezone Linux

    • timedatectl

    • date

    • Hasil: Asia/Makassar (WITA)

  2. ✅ Memastikan timezone PHP CLI

    • Awalnya:

      php -r "echo date_default_timezone_get();"
      

      Hasil:

      UTC
      
    • Setelah diperbaiki:

      Asia/Makassar
      
  3. ✅ Memastikan PHP-FPM yang dipakai website

    • Nginx menggunakan:

      fastcgi_pass unix:/run/php/php8.2-fpm.sock;
      
  4. ✅ Memastikan PHP-FPM sudah memakai timezone lokal

    • Membuat info.php

    • Hasil:

      Asia/Makassar
      2026-07-19 10:00:04
      
  5. ✅ Memastikan MariaDB tidak bermasalah

    SELECT NOW(), @@session.time_zone, @@global.time_zone;
    

    Hasil:

    • NOW() sesuai WITA

    • timezone = SYSTEM

  6. ✅ Memastikan struktur tabel

    • created_at dan published_at bertipe DATETIME, bukan TIMESTAMP.

    • Artinya MariaDB tidak mengubah timezone.

  7. ✅ Memeriksa NewsModel

    • Ditemukan:

      protected $useTimestamps = true;
      
    • Berarti CodeIgniter mengisi created_at dan updated_at.

  8. ✅ Memeriksa App.php

    • Ditemukan:

      public string $appTimezone = 'UTC';
      

Perubahan yang benar-benar menyelesaikan masalah

1. Mengubah timezone PHP

CLI

/etc/php/8.2/cli/php.ini

ubah menjadi

date.timezone = Asia/Makassar

PHP-FPM

/etc/php/8.2/fpm/php.ini

ubah menjadi

date.timezone = Asia/Makassar

lalu:

systemctl restart php8.2-fpm

2. Mengubah timezone CodeIgniter

File:

app/Config/App.php

dari

public string $appTimezone = 'UTC';

menjadi

public string $appTimezone = 'Asia/Makassar';

Hasil akhir

Sebelumnya:

created_at   : 2026-07-19 01:57:55
published_at : 2026-07-19 01:57:55

Sesudah perubahan:

created_at   : 2026-07-19 10:10:35
published_at : 2026-07-19 10:10:35
updated_at   : 2026-07-19 10:10:35

Semuanya sudah mengikuti waktu lokal (WITA).


Kesimpulan teknis

Akar masalahnya bukan pada controller News.php, bukan pada NewsModel.php, dan bukan pada MariaDB. Penyebabnya adalah konfigurasi timezone yang belum selaras:

  • PHP masih menggunakan UTC.

  • CodeIgniter ($appTimezone) juga masih UTC.

Setelah kedua konfigurasi tersebut disamakan ke Asia/Makassar, seluruh proses penyimpanan tanggal pada berita berjalan sesuai waktu lokal. Ini juga menjelaskan mengapa kode controller dari pengembang sebenarnya tidak perlu diubah—yang perlu diperbaiki adalah konfigurasi lingkungan dan konfigurasi aplikasi.

Friday, 3 July 2026

Hitung berapa jumlah file php

 

Dari daftar yang Anda tampilkan, terdapat 141 file berekstensi .php di direktori:

/var/www/html/moodle/local/jurnalmengajar

Perhitungan tersebut tidak menghitung:

  • Direktori (amd, assets, classes, cli, css, db, lang, pix, templates, vendor, dll.)

  • File non-PHP seperti:

    • composer.json

    • composer.lock

    • jadwal_pengawas.json

  • File backup seperti:

    • export_berita_acara_pdf.php.save

    • tv.php.save

    • tv.php.save.1

Jika yang dimaksud adalah semua file PHP secara rekursif (termasuk di dalam classes/, cli/, db/, dll.), maka jumlahnya akan lebih banyak. Anda bisa mengeceknya langsung di Debian dengan:

find /var/www/html/moodle/local/jurnalmengajar -type f -name "*.php" | wc -l

atau untuk melihat daftarnya:

find /var/www/html/moodle/local/jurnalmengajar -type f -name "*.php" | sort

Friday, 29 May 2026

Menampilkan teks biasa di halaman php moodle

Kalau ingin menampilkan teks biasa, harus memakai:

echo

atau HTML.

Yang benar:

echo html_writer::start_div();

echo '<b>Pilih opsi berikut untuk Cetak Harian Bulanan</b><br><br>';

echo html_writer::label('Bulan', 'bulan') . ' ';

Atau lebih rapi:

echo html_writer::start_div(
    null,
    null,
    ['style' => 'margin-top:10px']
);

echo html_writer::tag(
    'div',
    'Pilih opsi berikut untuk Cetak Harian Bulanan',
    [
        'style' => '
            font-weight:bold;
            margin-bottom:8px;
            color:#0f4c81;
        '
    ]
);

echo html_writer::label('Bulan', 'bulan') . ' ';

Hasilnya nanti muncul seperti judul kecil di atas dropdown.

Thursday, 23 April 2026

🚀 Install Moodle 🔥

 🔥 kita langsung gas install stack Moodle (LEMP: Nginx + MariaDB + PHP) yang stabil & ringan untuk server Guru.


🚀 1. Install semua paket sekaligus

apt install nginx mariadb-server php-fpm php-mysql php-xml php-gd php-curl php-zip php-intl php-mbstring php-soap php-bcmath php-cli php-opcache php-ldap php-imagick unzip git -y

🐘 2. Aktifkan service penting

systemctl enable nginx
systemctl enable mariadb
systemctl enable php8.2-fpm

systemctl start nginx
systemctl start mariadb
systemctl start php8.2-fpm

🔐 3. Amankan MariaDB

mysql_secure_installation

👉 Jawaban:

  • Set root password → YES

  • Remove anonymous → YES

  • Disallow root remote → YES

  • Remove test DB → YES


🧠 4. Buat database Moodle

Masuk MariaDB:

mysql -u root -p

Lalu:

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'passwordku';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

👉 Ganti:

  • passwordku → password aman versi Guru


⚙️ 5. Setting PHP (WAJIB)

nano /etc/php/8.2/fpm/php.ini

Cari & ubah:

memory_limit = 512M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 300

Simpan lalu:

systemctl restart php8.2-fpm

📁 6. Siapkan folder Moodle

mkdir -p /var/www/moodle
mkdir -p /var/moodledata

chown -R www-data:www-data /var/www/moodle
chown -R www-data:www-data /var/moodledata

chmod -R 755 /var/www/moodle
chmod -R 770 /var/moodledata

🌐 7. Config Nginx (siap pakai)

nano /etc/nginx/sites-available/moodle

Isi:

server {
    listen 80;
    server_name _;

    root /var/www/moodle;
    index index.php index.html;

    client_max_body_size 100M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg)$ {
        expires max;
        log_not_found off;
    }
}

Aktifkan:

ln -s /etc/nginx/sites-available/moodle /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx

📦 8. Download Moodle

cd /var/www/
git clone -b MOODLE_405_STABLE git://git.moodle.org/moodle.git moodle

Set permission lagi:

chown -R www-data:www-data /var/www/moodle

⏰ 9. Setup cron Moodle

crontab -e

Isi:

* * * * * /usr/bin/php /var/www/moodle/admin/cli/cron.php >/dev/null

🌍 10. Akses Moodle

Buka browser:

👉 http://IP_SERVER


🎯 STATUS SEKARANG

Kalau semua benar:

  • Nginx ✅

  • PHP ✅

  • MariaDB ✅

  • Moodle siap install via web ✅


🚀 NEXT STEP

Nanti di browser:

  • pilih bahasa

  • isi database:

    • DB name: moodle

    • user: moodleuser

    • password: (yang dibuat tadi)



Wednesday, 1 April 2026

solusi max_input_vars

 solusi max_input_vars

Masalah ini dari Moodle → Site administration → Server → Environment
Error: PHP setting max_input_vars must be at least 5000

Artinya PHP Anda membatasi jumlah input form terlalu kecil, sehingga form besar (misalnya edit course, plugin, dll) bisa gagal disimpan.


Solusi (Ubuntu / Debian / Nginx / Apache sama saja)

Edit file php.ini

1. Cari lokasi php.ini

Jalankan:

php --ini

Biasanya hasilnya seperti:

/etc/php/8.2/cli/php.ini
/etc/php/8.2/fpm/php.ini
/etc/php/8.2/apache2/php.ini

Kalau pakai Nginx → edit yang fpm
Kalau pakai Apache → edit apache2


2. Edit php.ini

Contoh untuk PHP 8.2 FPM:

sudo nano /etc/php/8.2/fpm/php.ini

Cari:

max_input_vars

Ubah menjadi:

max_input_vars = 5000

Atau lebih aman:

max_input_vars = 10000

3. Restart service

Kalau Nginx:

sudo systemctl restart php8.2-fpm
sudo systemctl restart nginx

Kalau Apache:

sudo systemctl restart apache2

4. Cek lagi di Moodle

Masuk:

Site administration → Server → Environment

Harus sudah PASS (hijau)


Rekomendasi setting Moodle lainnya sekalian

Di php.ini sekalian set:

memory_limit = 512M
upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 300
max_input_vars = 10000

Kalau mau, kirim:

php -v

biar saya arahkan file php.ini yang benar.

 

 

Thursday, 12 March 2026

Service yang WAJIB hidup untuk Moodle

 

Guru Duan, untuk mengakses Moodle di http://localhost, ada 3 service utama yang harus hidup.


Service yang WAJIB hidup untuk Moodle

1️⃣ Web Server

Menampilkan halaman web Moodle.

Service:

nginx.service

Start:

sudo systemctl start nginx

2️⃣ PHP Engine

Menjalankan kode PHP Moodle.

Service:

php8.2-fpm.service

Start:

sudo systemctl start php8.2-fpm

3️⃣ Database

Menyimpan data Moodle.

Service:

mariadb.service

Start:

sudo systemctl start mariadb

Jalankan semua sekaligus

Supaya cepat:

sudo systemctl start nginx php8.2-fpm mariadb

Setelah itu buka browser:

http://localhost/moodle

atau jika di root:

http://localhost

Service yang TIDAK wajib untuk Moodle

Ini tidak mempengaruhi Moodle:

  • pihole-FTL

  • cloudflared

  • docker

  • redis (kecuali dipakai cache)

  • openvpn


Cara cek apakah sudah hidup

systemctl status nginx php8.2-fpm mariadb

Harus muncul:

Active: active (running)

Tips supaya cepat

Guru Duan bisa buat alias:

Tambahkan di ~/.bashrc

alias moodleon="sudo systemctl start nginx php8.2-fpm mariadb"
alias moodleoff="sudo systemctl stop nginx php8.2-fpm mariadb"

Lalu reload:

source ~/.bashrc

Sekarang cukup ketik:

moodleon

Jika Guru Duan mau, saya juga bisa tunjukkan cara mengetahui dalam 3 detik apakah Moodle tidak bisa diakses karena nginx, php, atau database. Ini trik yang sangat membantu saat debugging server.

Tuesday, 3 March 2026

matikan nginx php di laptop

 

Bisa, Guru Duan 👍
TAPI tergantung tujuan laptopnya.

Karena laptop Guru Duan menjalankan:

  • Moodle

  • WordPress

  • Pi-hole

maka:

  • nginx → web server

  • php8.2-fpm → eksekusi PHP

Kalau dua ini dimatikan:

❌ Moodle tidak bisa dibuka
❌ WordPress tidak bisa dibuka
❌ Local web project tidak jalan


🎯 Kapan BOLEH dimatikan nginx & php?

✅ Kalau laptop hanya dipakai browsing / kerja biasa
✅ Tidak sedang testing Moodle
✅ Tidak butuh WordPress lokal
✅ Tidak expose tunnel cloudflared

Kalau itu kondisi Guru Duan → boleh dimatikan.


🧪 Cara Aman (Stop Sementara Dulu)

Coba stop dulu, bukan disable:

sudo systemctl stop nginx
sudo systemctl stop php8.2-fpm

Lalu cek:

systemctl status nginx
systemctl status php8.2-fpm

Kalau mau aktifkan lagi:

sudo systemctl start nginx
sudo systemctl start php8.2-fpm

🚫 Kalau Mau Disable Permanen

sudo systemctl disable nginx
sudo systemctl disable php8.2-fpm

Aktifkan lagi:

sudo systemctl enable nginx
sudo systemctl enable php8.2-fpm

🔥 Rekomendasi Untuk Laptop Guru Duan

Karena Guru Duan sering:

  • Testing Moodle

  • Cek plugin

  • Setup jaringan

  • Uji Pi-hole

Lebih baik jangan disable permanen.

Lebih baik:

  • Stop saja kalau tidak dipakai

  • Atau pakai alias cepat

Contoh buat alias di ~/.bashrc:

alias webon="sudo systemctl start nginx php8.2-fpm"
alias weboff="sudo systemctl stop nginx php8.2-fpm"

Jadi tinggal ketik:

weboff
webon

Lebih praktis 😄


Kalau boleh tahu Guru Duan, tujuan mematikan nginx & php ini untuk hemat RAM atau ada masalah tertentu?

Saturday, 15 November 2025

agar output pdf menampilkan tanggal waktu ubah jadi

 asalnya
    $pdf->Output('kartu_peserta_ujian.pdf','I');
    
agar pdf menampilkan tanggal waktu ubah jadi
 
    $pdf->Output('kartu_peserta_ujian_' . userdate(time(), '%Y%m%d_%H%M%S') . '.pdf', 'I');

Friday, 1 August 2025

Perintah edit config php atau upgrade moodle cli

upgrade cli 

php /var/www/html/moodle/admin/cli/upgrade.php


edit config php

nano /var/www/html/moodle/config.php
 


Saturday, 19 July 2025

Tab Switch Button

 

Kalau Guru Duan memilih untuk menyalin kode tab switch ke masing-masing file (tanpa fungsi), pastikan tetap konsisten seperti ini:


✅ Di today.php:

echo html_writer::start_div('mb-3');
echo html_writer::link(new moodle_url('/local/jurnalmengajar/today.php'), '⏰ Urut Waktu', ['class' => 'btn btn-primary']);
echo ' ';
echo html_writer::link(new moodle_url('/local/jurnalmengajar/today_perguru.php'), '🧑‍🏫 Per Guru', ['class' => 'btn btn-outline-secondary']);
echo ' ';
echo html_writer::link(new moodle_url('/local/jurnalmengajar/bydate.php'), '📅 Per Tanggal', ['class' => 'btn btn-outline-secondary']);
echo html_writer::end_div();

✅ Di today_perguru.php:

echo html_writer::start_div('mb-3');
echo html_writer::link(new moodle_url('/local/jurnalmengajar/today.php'), '⏰ Urut Waktu', ['class' => 'btn btn-outline-secondary']);
echo ' ';
echo html_writer::link(new moodle_url('/local/jurnalmengajar/today_perguru.php'), '🧑‍🏫 Per Guru', ['class' => 'btn btn-primary']);
echo ' ';
echo html_writer::link(new moodle_url('/local/jurnalmengajar/bydate.php'), '📅 Per Tanggal', ['class' => 'btn btn-outline-secondary']);
echo html_writer::end_div();

✅ Di bydate.php:

echo html_writer::start_div('mb-3');
echo html_writer::link(new moodle_url('/local/jurnalmengajar/today.php'), '⏰ Urut Waktu', ['class' => 'btn btn-outline-secondary']);
echo ' ';
echo html_writer::link(new moodle_url('/local/jurnalmengajar/today_perguru.php'), '🧑‍🏫 Per Guru', ['class' => 'btn btn-outline-secondary']);
echo ' ';
echo html_writer::link(new moodle_url('/local/jurnalmengajar/bydate.php'), '📅 Per Tanggal', ['class' => 'btn btn-primary']);
echo html_writer::end_div();

Catatan:

  • Jangan tukar urutan, biar tampilan antar halaman tetap familiar bagi pengguna.

  • Jangan ubah btn-primary dan btn-outline-secondary secara acak — pastikan hanya satu yang aktif per halaman.

Kalau nanti ingin tambahkan tab baru (misalnya "📊 Rekap"), akan lebih merepotkan karena harus ubah semua file. Kalau begitu, mungkin saat itu bisa dipertimbangkan pakai fungsi ya Guru 😊

Thursday, 26 June 2025

Mengaktifkan debugging saat pengembangan config php

 

✅ Langkah Diagnosa Cepat

1. 🔧 Aktifkan mode debug Moodle

Masukkan ini di config.php Moodle (sebelum baris require_once apa pun):

@error_reporting(E_ALL | E_STRICT);
@ini_set('display_errors', '1');
$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;
 

Wednesday, 25 June 2025

Konfigurasi Config Dinamis domain atau lokal

 // Deteksi apakah akses dari cloudflared (domain *.sman2kandangan.sch.id) atau lokal
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';

// Cek apakah domain mengandung sman2kandangan.sch.id
if (preg_match('/\.?sman2kandangan\.sch\.id$/', $host)) {
    $CFG->wwwroot = 'https://' . $host;
    $CFG->sslproxy = true;
} else {
    // Default ke localhost jika bukan domain online
    $CFG->wwwroot = 'http://localhost';
    $CFG->sslproxy = false;
}

🔥 Perintah untuk menghapus seluruh PHP 7.4:

 sudo apt remove --purge 'php7.4*'
sudo apt autoremove
sudo apt clean

Untuk melihat daftar semua paket PHP 7.4 sebagai backup log sebelum uninstall.

 # dpkg -l | grep php7.4
ii  php7.4                          1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.4-cli                      1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        command-line interpreter for the PHP scripting language
ii  php7.4-common                   1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        documentation, examples and common module for PHP
ii  php7.4-curl                     1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        CURL module for PHP
ii  php7.4-fpm                      1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.4-gd                       1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        GD module for PHP
ii  php7.4-intl                     1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        Internationalisation module for PHP
ii  php7.4-json                     1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        JSON module for PHP
ii  php7.4-mbstring                 1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        MBSTRING module for PHP
ii  php7.4-mysql                    1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        MySQL module for PHP
ii  php7.4-opcache                  1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        Zend OpCache module for PHP
ii  php7.4-readline                 1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        readline module for PHP
ii  php7.4-soap                     1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        SOAP module for PHP
ii  php7.4-xml                      1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php7.4-zip                      1:7.4.33-20+0~20250510.109+debian11~1.gbpea199f   amd64        Zip module for PHP

config php untuk online dan lokal

 <?php

unset($CFG);
global $CFG;
$CFG = new stdClass();

// Deteksi apakah akses dari cloudflared (domain online) atau lokal
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';

// Atur domain Moodle sesuai host yang digunakan
if (strpos($host, 'wan.sman2kandangan.sch.id') !== false) {
    $CFG->wwwroot = 'https://' . $host;
    $CFG->sslproxy = true;
} else {
    $CFG->wwwroot = 'http://localhost';
    $CFG->sslproxy = false;
}

// Tetap atur dataroot seperti biasa
$CFG->dataroot = '/var/moodledata'; // Ganti dengan path sebenarnya
$CFG->dbtype    = 'mariadb';             // Sesuaikan dengan config awal kamu
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';             // Ganti dengan nama database kamu
$CFG->dbuser    = 'moodleuser';         // Ganti dengan user database kamu
$CFG->dbpass    = 'password_kuat';           // Ganti dengan password-nya
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_unicode_ci',
);

// Tambahkan baris ini untuk menyelesaikan konfigurasi
require_once(__DIR__ . '/lib/setup.php');

PHP and DBMS compatibility of major Moodle releases

 

PHP and DBMS compatibility of major Moodle releases

We get a non-ending stream of requests in the moodle.org forums from people having trouble in marching old Moodle installations to newer and supported versions. Things break easily since along the path the system requirements have been evolving too. The following table summarizes their dependencies. (Last edited 2025-04-22 08:49 UTC)

Target  Earliest 
from
 PHP   MySQL   PgSQL   MariaDB 
 min.   max.   min.   max.   min.   max.   min.   max. 
1.6[1] 1.0 4.3.0 5.6 4.1.16 ? 8.0 ? - -
1.9[2] 1.6 4.3.0 5.6 4.1.16 5.7? 8.0 ? - -
2.2[3] 1.9 5.3.2 5.6 5.0.25 5.7? 8.3 ? - -
2.4 2.2 5.3.2 5.6 5.1.33 5.7? 8.3 ? - -
2.7 (LTS) 2.2 5.4.4 5.6 5.5.31 5.7? 9.1 ? 5.5.31 10.2
3.0 2.2 5.4.4 7.0 5.5.31 5.7? 9.1 ? 5.5.31 10.2
3.1 (LTS) 2.7 5.4.4 7.0 5.5.31 5.7 9.1 ? 5.5.31 10.2
3.2 2.7 5.6.5 7.1 5.5.31 5.7 9.1 ? 5.5.31 10.2
3.3 2.7 5.6.5 7.1 5.5.31 5.7 9.3 ? 5.5.31 10.2
3.4 3.0 7.0 7.1 5.5.31 5.7 9.3 ? 5.5.31 10.2
3.5 (LTS) 3.1 7.0 7.2 5.5.31 8.0 9.3 ? 5.5.31 10.5
3.6 3.1 7.0 7.3 5.6 8.0 9.4 ? 10.0? 10.5
3.7 3.2 7.1 7.3 5.6 8.0 9.4 ? 10.0? 10.5
3.8 3.2 7.1 7.4[4] 5.6 8.0 9.4 ? 10.0? 10.5
3.9 (LTS) 3.5 7.2 7.4 5.6 8.0 9.5 ? 10.2.29 10.6 (not 10.6.0-10.6.6)
3.10 3.5 7.2 7.4 5.7 8.0 9.6 ? 10.2.29 10.6 (not 10.6.0-10.6.6)
3.11 3.6 7.3 8.0[5] 5.7 8.0 9.6 ? 10.2.29 10.6 (not 10.6.0-10.6.6)
4.0 3.6 7.3 8.0[5] 5.7 8.0 10 ? 10.2.29 10.6 (not 10.6.0-10.6.6)
4.1 (LTS) 3.9 7.4 8.1[6] 5.7 latest 12 ? 10.4 10.11
4.2 3.11 8.0[8] 8.2[7] 8.0 latest 13 ? 10.6.7 latest
4.3 3.11.8 8.0[8] 8.2 8.0 latest 13 ? 10.6.7 latest
4.4 4.1.2 8.1[8] 8.3 8.0 latest 13 ? 10.6.7 latest
4.5 (LTS) 4.1.2 8.1[8] 8.3 8.0 latest 13 ? 10.6.7 latest
4.6 (experimental)[9] 4.1.2 8.1[8] 8.3 8.0 latest 13 ? 10.6.7 latest
5.0 4.2.3 8.2 8.3[10] 8.4 latest 14 ? 10.11.0 latest

Footnotes:

  1. Release 1.6 was a de-facto LTS, supported for 3 years
  2. Release 1.9 was a de-facto LTS, supported for 6 years
  3. Upgrade from 1.9 to 2.x broke so many things, it is advisable to rebuild the site - either through course backups and restore or create courses from scratch making use of the numerous new features added since then
  4. PHP 7.4 since release 3.8.3. See MDL-66260.
  5. PHP 8.0 since Moodle 3.11.8 and 4.0.2. See MDL-70745.
  6. PHP 8.1 since Moodle 4.1.2. See MDL-73016.
  7. PHP 8.2 since Moodle 4.2.3. See MDL-76405
  8. 64 bit PHP only. See MDL-76405
  9. Released December 2024 Announcement and discussion
  10. MDL-80117

Monday, 23 June 2025

disable mariadb, phpfpm

 $ sudo systemctl disable --now \
  mariadb.service \
  php8.2-fpm.service \

[sudo] password for dhwan: 
Synchronizing state of mariadb.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install disable mariadb
Synchronizing state of php8.2-fpm.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install disable php8.2-fpm
Removed "/etc/systemd/system/multi-user.target.wants/mariadb.service".
Removed "/etc/systemd/system/multi-user.target.wants/php8.2-fpm.service".


erintah sudo systemctl disable --now mariadb.service php8.2-fpm.service tidak menghapus MariaDB maupun PHP-FPM.
✅ Itu hanya menonaktifkan layanan mereka agar tidak dijalankan otomatis saat boot, dan jika sedang berjalan, dihentikan sekarang juga.


📦 Paket-paket masih tetap terpasang di sistem kamu.


Sunday, 22 June 2025

Cek webserver, php, mariadb version

 

✅ 1. Cek Web Server: Apache atau Nginx

Jalankan:

ps aux | grep -E 'apache2|nginx'

root 1941 0.0 0.0 11156 1532 ? Ss 06:18 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 1942 0.0 0.0 13028 4788 ? S 06:18 0:00 nginx: worker process
www-data 1943 0.0 0.0 13028 4656 ? S 06:18 0:00 nginx: worker process
www-data 1944 0.0 0.0 13028 4444 ? S 06:18 0:00 nginx: worker process
www-data 1945 0.0 0.0 12896 3596 ? S 06:18 0:00 nginx: worker process
dhwan 38805 0.0 0.0 9144 2044 pts/1 S+ 09:55 0:00 grep --color=auto -E apache2|nginx

Contoh output:

  • Jika Anda melihat proses apache2, berarti pakai Apache

  • Jika Anda melihat proses nginx, berarti pakai Nginx

✅ 2. Cek Versi PHP

Jalankan:php -v
$ php -v
PHP 8.2.28 (cli) (built: Mar 13 2025 18:13:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies

✅ 3. Cek Versi MySQL atau MariaDB

Cek apakah Anda pakai MySQL atau MariaDB:


Jalankan: mysql -V
$ mysql -V
mysql Ver 15.1 Distrib 10.11.13-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper


Friday, 6 June 2025

Config php moodle offline localhost dan online tunel cloudflared

<?php

unset($CFG);
global $CFG;
$CFG = new stdClass();

// Deteksi apakah akses dari cloudflared (domain online) atau lokal
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';

// Atur domain Moodle sesuai host yang digunakan
if (strpos($host, 'wan.sman2kandangan.sch.id') !== false) {
    $CFG->wwwroot = 'https://' . $host;
    $CFG->sslproxy = true;
} else {
    $CFG->wwwroot = 'http://localhost';
    $CFG->sslproxy = false;
}

// Tetap atur dataroot seperti biasa
$CFG->dataroot = '/var/moodledata'; // Ganti dengan path sebenarnya
$CFG->dbtype    = 'mariadb';             // Sesuaikan dengan config awal kamu
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';             // Ganti dengan nama database kamu
$CFG->dbuser    = 'moodleuser';         // Ganti dengan user database kamu
$CFG->dbpass    = 'password';           // Ganti dengan password-nya
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_unicode_ci',
);

// Tambahkan baris ini untuk menyelesaikan konfigurasi
require_once(__DIR__ . '/lib/setup.php');