Pi Zero W - Optimal Settings For LAMP

Hello,

I have a pi zero w as a web server for my office. I have set up and running a small web app( crud style, bootstarp and datatables, around 10pages ). It is 1-4 users max.

I have set up Apache, PHP 7, MariaDB. It is fast and stable.

My only problem is once a day i run a big query that it takes 30sec to load.

In my Pi 4 it is taking 2sec. I run MySQLTuner and i show errors in memory and etc.

I would like someone to help my fine tune my server according to PI Zero W (cnf file or even apache/php).

Thank you.

ps:
I prefer Pi Zero W as it lightweight/small/cheap and can have it with me all around(home,holidays).

Do you know how much RAM is being used when idle?

Have you tried enabling/installing ZRAM/ZSWAP to alleviate the low RAM availability in many SBC’s?

What does free -m show?

Pi W only has a single core processor compared to a quad core (along with more RAM) so it will definitely run ALOT faster than the Pi W, plus Pi W is 32 bit vs the Pi 4’s 64 bit architecture

https://magpi.raspberrypi.org/articles/raspberry-pi-specs-benchmarks