Created
May 7, 2025 09:47
-
-
Save cakmalik/b6dd30d19b187b7fb5730e341efaeacb to your computer and use it in GitHub Desktop.
script for delete Webserver and Php for Arch Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "🚨 Mulai proses penghapusan PHP, Web Server, dan MySQL dari sistem Anda..." | |
| # 1. Hapus PHP dari pacman (repo resmi) | |
| echo "🧹 Menghapus PHP dari pacman..." | |
| sudo pacman -Rns --noconfirm $(pacman -Qsq php) 2>/dev/null | |
| # 2. Hapus Web Server: Apache & Nginx | |
| echo "🧹 Menghapus Web Server (Apache dan Nginx)..." | |
| sudo systemctl stop httpd nginx 2>/dev/null | |
| sudo pacman -Rns --noconfirm $(pacman -Qsq apache) 2>/dev/null | |
| sudo pacman -Rns --noconfirm $(pacman -Qsq nginx) 2>/dev/null | |
| # 3. Hapus MySQL/MariaDB | |
| echo "🧹 Menghapus MySQL/MariaDB..." | |
| sudo systemctl stop mysqld mariadb 2>/dev/null | |
| sudo pacman -Rns --noconfirm $(pacman -Qsq mysql) 2>/dev/null | |
| sudo pacman -Rns --noconfirm $(pacman -Qsq mariadb) 2>/dev/null | |
| # 4. Hapus dari AUR jika menggunakan yay atau paru | |
| for aur_helper in yay paru; do | |
| if command -v $aur_helper &>/dev/null; then | |
| echo "🧹 Menghapus PHP, Web Server, dan MySQL dari AUR ($aur_helper)..." | |
| $aur_helper -Rns --noconfirm $($aur_helper -Qsq php apache nginx mysql mariadb) 2>/dev/null | |
| fi | |
| done | |
| # 5. Hapus phpbrew dan semua versinya | |
| if command -v phpbrew &>/dev/null; then | |
| echo "🧹 Menghapus phpbrew dan versinya..." | |
| phpbrew list | awk '{print $1}' | tail -n +3 | xargs -I{} phpbrew remove {} | |
| rm -rf ~/.phpbrew | |
| fi | |
| # 6. Hapus phpenv dan phpv jika ada | |
| echo "🧹 Menghapus phpenv dan phpv..." | |
| rm -rf ~/.phpenv ~/.phpv | |
| # 7. Hapus konfigurasi dan file global | |
| echo "🧹 Menghapus konfigurasi dan file global..." | |
| sudo rm -rf /etc/php* /usr/lib/php* /usr/include/php* /usr/share/php* | |
| sudo rm -rf /etc/httpd /etc/nginx /etc/mysql* /etc/mariadb* /var/lib/mysql* /var/lib/mariadb* | |
| sudo rm -rf /usr/lib/mysql* /usr/lib/mariadb* /usr/include/mysql* /usr/include/mariadb* | |
| # 8. Hapus konfigurasi user | |
| echo "🧹 Menghapus konfigurasi user..." | |
| rm -rf ~/.config/php ~/.local/share/php ~/.mysql_history ~/.cache/mysql | |
| # 9. Bersihkan PATH dan shell config | |
| echo "🧼 Membersihkan PATH dari phpbrew/phpenv..." | |
| sed -i '/phpbrew/d' ~/.bashrc ~/.zshrc 2>/dev/null | |
| sed -i '/phpenv/d' ~/.bashrc ~/.zshrc 2>/dev/null | |
| # 10. Verifikasi | |
| echo "🔍 Verifikasi apakah PHP, Web Server, dan MySQL masih ada..." | |
| for cmd in php httpd nginx mysql mariadb; do | |
| if command -v $cmd &>/dev/null; then | |
| echo "⚠️ Masih terdeteksi: $cmd -> $(which $cmd)" | |
| fi | |
| done | |
| # 11. Cari sisa file terkait | |
| echo "🔍 Mencari sisa file PHP, Web Server, dan MySQL..." | |
| sudo find / -iname "*php*" -o -iname "*mysql*" -o -iname "*mariadb*" -o -iname "*httpd*" -o -iname "*nginx*" \ | |
| -not -path "/proc/*" -not -path "/sys/*" >~/sisa_lamp_files.txt | |
| echo "📄 Daftar file tersisa disimpan di ~/sisa_lamp_files.txt" | |
| echo "✅ Proses penghapusan selesai." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment