Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

XAMPP – LAMPP Tutorials: List of Production Files to Cleanup Guide

Hereโ€™s a comprehensive and updated tutorial on which files should be cleaned up regularly in a production environment running XAMPP (under /opt/lampp), what each file/folder is, and how to automate cleanup safely.


XAMPP Production File Cleanup Guide

Keeping Your /opt/lampp Environment Healthy


1. Why Regular Cleanup Is Important

  • Performance: Old logs and cache files fill up disk space and slow down the system.
  • Security: Sensitive info in old logs can be a risk if not managed.
  • Reliability: Overfilled disk can cause XAMPP/MySQL/Apache to crash or refuse new data.

2. Key Locations in /opt/lampp to Clean

The typical XAMPP folder structure on Linux (like /opt/lampp) includes:

  • /opt/lampp/logs/ โ€” Apache and XAMPP logs
  • /opt/lampp/apache/logs/ โ€” Apache server logs
  • /opt/lampp/mysql/data/ or /opt/lampp/var/mysql/ โ€” MySQL data and logs
  • /opt/lampp/php/logs/ โ€” PHP logs
  • /opt/lampp/temp/ or /opt/lampp/tmp/ โ€” Temporary files
  • /opt/lampp/htdocs/ โ€” Website files (may have user/app caches, uploads, sessions)
  • Any storage/ directories for frameworks like Laravel

3. What Files Should Be Cleaned Regularly?

Below are the files and folders to clean, with what they do and how to handle them safely:


A. Apache Log Files

  • Location: /opt/lampp/logs/ and /opt/lampp/apache/logs/
  • Files:
    • access.log
    • error.log
    • Any rotated log files (e.g., error.log.1, access.log.1, .gz, etc.)
  • Why: These logs can get huge, fast.
  • How:
    • Delete old rotated/compressed logs (e.g., *.gz, .1 files)
    • Truncate main logs regularly (to avoid interrupting Apache): > /opt/lampp/logs/access.log > /opt/lampp/logs/error.log

B. PHP Error Logs

  • Location: /opt/lampp/php/logs/
  • Files:
    • php_error_log
  • Why: Captures PHP warnings/errors, can grow large.
  • How:
    • Truncate periodically: > /opt/lampp/php/logs/php_error_log

C. MySQL Log and Error Files

  • Location: /opt/lampp/var/mysql/ or /opt/lampp/mysql/data/
  • Files:
    • hostname.err (e.g., ip-172-31-34-212.err)
    • mysql-bin.* (binary logs, if enabled)
    • Slow query logs (mysql-slow.log, if enabled)
    • Old rotated logs (*.old, *.BAK, etc.)
  • Why: Large logs waste space; old binlogs arenโ€™t needed after backup/replication.
  • How:
    • Truncate the error log (never delete while MySQL is running): > /opt/lampp/var/mysql/ip-172-31-34-212.err
    • Remove old binlogs (only if not needed for recovery/replication): rm /opt/lampp/var/mysql/mysql-bin.00000*
    NEVER delete ibdata1, ib_logfile*, aria_log*, or any database folders/files here.

D. Temporary Files

  • Location: /opt/lampp/temp/, /opt/lampp/tmp/, and project storage/framework/cache, storage/framework/sessions, etc.
  • Files:
    • Upload temp files, session files, cache
  • Why: Safe to delete files not recently accessed (stale session, cache, failed uploads).
  • How:
    • Example to remove files older than 2 days: find /opt/lampp/temp/ -type f -mtime +2 -delete find /opt/lampp/tmp/ -type f -mtime +2 -delete

E. Application/Framework Cache & Session Files

  • Laravel example:
    /opt/lampp/htdocs/your_project/storage/framework/sessions/
    /opt/lampp/htdocs/your_project/storage/framework/cache/
    /opt/lampp/htdocs/your_project/storage/framework/views/
  • Why: Sessions, cache, and compiled views are safe to clear out if old.
  • How: find /opt/lampp/htdocs/your_project/storage/framework/sessions/ -type f -mtime +1 -delete find /opt/lampp/htdocs/your_project/storage/framework/cache/ -type f -mtime +1 -delete find /opt/lampp/htdocs/your_project/storage/framework/views/ -type f -mtime +1 -delete

F. Old Backup Files

  • Location: Wherever you store old .sql, .tar, .gz, etc. (often /backups/ or /opt/lampp/htdocs/backups/)
  • Why: Donโ€™t keep too many old backups.
  • How: find /opt/lampp/htdocs/backups/ -type f -mtime +7 -delete (Deletes backup files older than 7 days.)

4. What Should You NEVER Delete?

  • Database data files (ibdata1, ib_logfile0, etc. in var/mysql/)
  • Anything inside database directories (unless you want to drop/delete a database)
  • Application files, user uploads, etc. (unless verified as junk)
  • XAMPP config files

5. Automating Cleanup With a Cron Job

Hereโ€™s a sample script you could run daily or weekly via cron:

#!/bin/bash

# Clean Apache logs (keep last 7 days)
find /opt/lampp/logs/ -type f -name "*.gz" -mtime +7 -delete
find /opt/lampp/apache/logs/ -type f -name "*.gz" -mtime +7 -delete

# Truncate current log files
> /opt/lampp/logs/access.log
> /opt/lampp/logs/error.log
> /opt/lampp/php/logs/php_error_log

# Truncate MySQL error log
> /opt/lampp/var/mysql/ip-172-31-34-212.err

# Clean temp files older than 2 days
find /opt/lampp/tmp/ -type f -mtime +2 -delete
find /opt/lampp/temp/ -type f -mtime +2 -delete

# Clean Laravel/Framework session & cache files older than 1 day
find /opt/lampp/htdocs/your_project/storage/framework/sessions/ -type f -mtime +1 -delete
find /opt/lampp/htdocs/your_project/storage/framework/cache/ -type f -mtime +1 -delete
find /opt/lampp/htdocs/your_project/storage/framework/views/ -type f -mtime +1 -delete

# Clean old backup files (older than 7 days)
find /opt/lampp/htdocs/backups/ -type f -mtime +7 -delete
Code language: PHP (php)
  • Save this as cleanup_xampp.sh
  • Make it executable:
    chmod +x cleanup_xampp.sh
  • Add to crontab for daily execution (example at 2:30am): 30 2 * * * /path/to/cleanup_xampp.sh

6. Monitoring Disk Usage

  • Regularly check usage: du -sh /opt/lampp/*
  • Be proactive; if logs grow rapidly, increase cleanup frequency or log rotation.

7. Security and Best Practices

  • Always review before deletingโ€”automate with care.
  • Take regular full backups before aggressive cleaning, especially before touching anything in var/mysql/.
  • Set up logrotate for Apache, PHP, and MySQL logs for better management.
  • Document your cleanup routines for the team.

Summary Table

LocationWhat to CleanCommand ExampleNotes
/opt/lampp/logs/Apache logs> access.logRotate/truncate; donโ€™t delete active logs
/opt/lampp/php/logs/PHP logs> php_error_log
/opt/lampp/var/mysql/MySQL error logs> hostname.errNever delete core DB files
/opt/lampp/tmp/ /opt/lampp/temp/Temp filesfind ... -mtime +2 -deleteOnly old files
/opt/lampp/htdocs/project/storage/Sessions, cachefind ... -mtime +1 -deleteFramework-specific
/opt/lampp/htdocs/backups/Old backupsfind ... -mtime +7 -deleteOptional

Conclusion

Regular cleanup of log, temp, and cache files under /opt/lampp keeps your production XAMPP environment healthy, secure, and reliable.
Never delete database or config files, always backup before cleaning, and automate your routines for peace of mind!


Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Top 10 Integration Platform as a Service (iPaaS) Tools in 2026: Features, Pros, Cons & Comparison

Introduction In todayโ€™s fast-paced digital world, businesses are leveraging multiple software applications, cloud services, and data sources to streamline operations. However, the challenge lies in integrating these…

Read More

IReviewed Blog’s Post List

truereviewnow.com is a portal for product review and rating. truereviewnow.com is having very in-depth analysis of review and testimony of Mobiles, Laptop, Electronics Gadgets, Airports, Boradbands, Movies…

Read More

Top 10 Social Media Management Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, social media continues to be a cornerstone of digital marketing strategies, shaping how businesses connect with their audiences. With millions of users interacting on…

Read More

Top 10 Drone Software Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, drones are not only revolutionizing industries like agriculture, logistics, filmmaking, and construction, but also the way we collect and process data. Drone software is…

Read More

Top 10 AI Survey Automation Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI Survey Automation Tools are transforming the way businesses, researchers, and organizations gather and analyze feedback. Traditional survey platforms often relied on static questions…

Read More

Top 10 AI Animation Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI animation tools are revolutionizing how creators, businesses, and educators bring stories to life, making animation accessible to all skill levels. These tools leverage…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Jason Mitchell
Jason Mitchell
6 months ago

Very helpful guide! The explanation of which XAMPP/LAMPP files and logs should be cleaned in a production environment is clear and practical. Itโ€™s a useful reference for developers and admins who want to keep their server organized and running smoothly.

1
0
Would love your thoughts, please comment.x
()
x