RPI classic web-server
Posted by kll on January 20 2026 09:47:42

LAMP


Linux (Operating System), Apache (Web Server), MySQL (Database), and PHP (Programming Language)


Extended Blog
here play with
* old RPI3
* ethernet and power cable .aka. headless
* 32GB uSD

setup RPI OS 64bit Lite


on a RPI4 run
Raspberry Pi Imager (v2.0.1)
* Raspberry Pi 3
* Raspberry Pi OS 64bit Lite / non desktop version
* uSD card 32GB
* rpi3lite
* bangkok / asia bangkok / keyboard US
* user pi password YOURpiPASSWORD
* skip wifi
* enable SSH use password
* NOT enable Pi Connect
[WRITE] [ERASE]

after uSD write / verify
optional: uSD remove and re-insert

edit /media/pi/bootfs/cmdline.txt
and add inline
' ip=192.168.1.103 '
save

unmount uSD
remove uSD from RPI4


and insert into RPI3 / powerup RPI3 and wait..

login RPI3:
ssh pi@192.168.1.103
YOURpiPASSWORD


optional: sudo nano /boot/firmware/cmdline.txt now in a different directory and change back the fix IP there
and make fix IP better way


sudo nmcli c show
sudo nmcli c mod 'Wired connection 1' ipv4.addresses 192.168.1.103/24 ipv4.method manual
sudo nmcli con mod 'Wired connection 1' ipv4.gateway 192.168.1.1
sudo nmcli con mod 'Wired connection 1' ipv4.dns "10.10.30.1 8.8.8.8 8.8.4.4"
sudo nmcli device show 'eth0'


update 27.01.2026
error about NO 'Wired connection 1'
?now must use 'netplan-eth0'
can also try
nmtui
!! REBURN RPIOS Lite 64B from RPI4 and OK


sudo reboot

and UPDATE
sudo apt update && sudo apt upgrade -y


optional: ( my default tools )
sudo apt install -y mc tree fastfetch nmap hdparm
for install fresh editor:
curl https://raw.githubusercontent.com/sinelaw/fresh/refs/heads/master/scripts/install.sh | sh
see https://getfresh.dev/
for use it in
mc [F4]
edit .selected_editor
replace /bin/nano with /bin/fresh
when problems with copy paste:
Use the correct keyboard shortcuts: In most terminal emulators (like Alacritty, GNOME Terminal, or iTerm2),
Ctrl+Shift+C copies and Ctrl+Shift+V pastes.


as the RPI OS light version not has the SD card copy tool, try
curl https://raw.githubusercontent.com/geerlingguy/rpi-clone/master/install | sudo bash
see https://rpi-clone.jeffgeerling.com/


SAMBA



mkdir ~/Projects
sudo apt install -y samba

sudo nano /etc/samba/smb.conf

#add after [homes] before [printers]:
[RPI3lite_share]
path = /home/pi/Projects
writeable = yes
browseable = yes
public = no

sudo smbpasswd -a pi
pw
pw

sudo systemctl restart smbd



install web-server tools


while some would say LAMP is old stuff, ? compared to NODE ?
a usual web-space on the internet still provides exactly that
so i would call it 'industrial standard'
( while i would not know how to setup a NODE web-server online without a credit card,
you might still find some free web-space with LAMP and easy installers for many CMS..)

in my last web-learning blogs i only used a NGINX server
( and setup via DOCKER plus a local volume on RPI3 )
just to make some static HTML pages ( add some JS ) available..

now i try to find some Raspberry Pi / Apache / PHP / MySql projects ?
first try
randomnerdtutorials.com/raspberry-pi-apache-mysql-php-lamp-server
too old
raspberrypi.org/en/projects/lamp-web-server-with-wordpress
still issues with WP,

found a newer one? (Updated Mar 01, 2025)
https://pimylifeup.com/raspberry-pi-apache/

https://pimylifeup.com/raspberry-pi-mysql/

https://pimylifeup.com/raspberry-pi-wordpress/
try again

Apache


sudo apt install apache2 -y
cd /var/www/html && ls -la
index.html

sudo usermod -a -G www-data $USER
sudo chown -R -f www-data:www-data /var/www/html
sudo chmod -R 770 /var/www/html

sudo reboot



external browser:
http://192.168.1.103/
and see that apache landing page index.html


Install PHP


sudo apt install php -y
sudo apt install php8.4 libapache2-mod-php8.4 php8.4-mbstring php8.4-mysql php8.4-curl php8.4-gd php8.4-zip -y


** optional make a example.php file
< ?php echo "Today's date is ".date('Y-m-d H:i:s'); ?>


sudo service apache2 restart
test: http://192.168.1.103/example.php


Install SQL


sudo apt install mariadb-server php-mysql -y
sudo service apache2 restart

sudo mysql_secure_installation ?? here "command not found"
this tutorial is from 2019 and also further problems
reg. phpMyAdmin
see comments on that old tutorial page

new:
sudo mariadb-secure-installation
and follow the second tutorial
set password for root
YOURrootPASSWORD



sudo apt install phpmyadmin -y
sudo phpenmod mysqli
sudo service apache2 restart


http://192.168.1.103/phpmyadmin/

on not found
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
can not login as
root YOURrootPASSWORD

after reboot OK



make a database


by CLI ( instead phpmyadmin )

sudo mysql -uroot -p
YOURrootPASSWORD

MariaDB [(none)]>
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'YOURdbPASSWORD';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
quit; ( or ) [Ctrl ][D]

sudo reboot
info:
db: wordpress
dbuser: wpuser
dbpassw: YOURdbPASSWORD



CMS


install a Content-Management-System
like WordPress
sudo wget https://wordpress.org/latest.tar.gz
( 26MB in 6sec )
using
sudo mc
i unzip content under
/var/www/html/wp/

as i want use a main index.html to link to several tests / in subdirs /
cd /var/www/html
sudo chown -R -f www-data:www-data /var/www/html


pls check on '[backslash];', this CMS autodeletes ''

sudo find . -type d -exec chmod 755 {} [backslash];
sudo find . -type f -exec chmod 644 {} [backslash];



sudo a2enmod rewrite
sudo systemctl restart apache2
sudo nano /etc/apache2/apache2.conf ( /var/www/ AllowOverride All )
sudo systemctl restart apache2





setup WordPress


when you try it
http://192.168.1.103
here
http://192.168.1.103/wp
it now links you to the setup
http://192.168.1.103/wp/wp-admin/setup-config.php
* english US
* setup
** wordpress
** wpuser
** YOURdbPASSWORD
** localhost
** wp_

Cannot select database
The database server could be connected to (which means your username and password is okay) but the database could not be selected.



try use the other way:
sudo cp /var/www/html/wp/wp-config-sample.php /var/www/html/wp/wp-config.php
sudo nano /var/www/html/wp/wp-config.php

add/edit
*database name : * wordpress
*database user : * wpuser
*database password : * YOURdbPASSWORD
save

open browser again, wordpress detects that config ( click )
and open the
http://192.168.1.103/wp/wp-admin/install.php

Welcome to the famous five-minute WordPress installation process!


make a CMS user and YOURcmsPASSWORD ...

Success!

WordPress has been installed.


for admin work go:
http://192.168.1.103/wp/wp-admin/
for view go:
http://192.168.1.103/wp/



learn how to fill a blog with blog entries and uploaded media ( pictures )

media upload
now get the picture into the blog
and save
Updating failed. The response is not a valid JSON response.
this might be about Site / URL settings?

not find a solution to that...
but a workaround here wp-tutorials as it bypasses API...
plugin add
Classic Editor
upload and activate

now edit a post and save ( and add a uploaded media ( picture ) )

>> possibly later how to customize WordPress by free themes ...


while this is similar to a situation with a online web-space,
i forget actually one basic point, for online web-space you use FTP for file transfer
that i did not install here, ( here with RPI i can use SFTP )


i am not much interested to use that
even i have that free online version:
https://kll-engineering.wordpress.com/


i want use this LAMP environment to play with this CMS: PHPFusion
even i can NOT recommend to use it anymore, as it is obsolete.

download to PC
PHPFusion 9.10.30.zip ( 7.9MB )

upload to
/var/www/html/kllfusion01/

( here i use Ubuntu 25.10 PC mc )
and that takes long time as that are 1932 files...
( independent if you upload single files or upload the zip and unzip on RPI3 )

now set ownership and default permissions for this path again
also see
PHPFusion 9.10.30/readme-en.html



and setup a other ( or use same ) database
db: PfDB
user: PfUSER
pw: PfPASSWORD

sudo mysql -uroot -p
YOURrootPASSWORD

MariaDB [(none)]>
CREATE DATABASE PfDB;
CREATE USER 'PfUSER'@'localhost' IDENTIFIED BY 'PfPASSWORD';
GRANT ALL PRIVILEGES ON PfDB.* TO 'PfUSER'@'localhost';
FLUSH PRIVILEGES;
quit; ( or ) [Ctrl ][D]




setup php fusion

Fatal error: Uncaught DateInvalidTimeZoneException: DateTimeZone::__construct(): Unknown or bad timezone
/var/www/html/kllfusion01/includes/classes/PHPFusion/Installer/Steps/AdminSetup.php on line 238

?? check
php -i | grep timezone
Default timezone => UTC
date.timezone => UTC => UTC

looks ok??

i assume i have a problem with old php?sql code and new installation,
so first i recheck what i run here on this server:
PHP version 8.1.33

( on RPI3 it's 8.4 / error is related to a change in 8.3 )

try a new setup ( again, now #4 )
also play to get newest RPI Imager v2.0.6 running on PC Ubuntu 25.10 as .AppImage
( install versions are 1.8 or 1.9 )


and this time without WP because can not have 2 server at same port 80





user : BlogUSER
pw : BlogPASSWORD
adminpw : adminBlogPASSWORD
email : info@Blog.com