setup LAMP

GNU-Linux Apache2 MariaDB PHP7.3

su - root; # become root
apt update; # update system to latest
apt upgrade;

# database first
apt install mariadb-server mariadb-client

# set root pwd for database (can be root on dev test server)

# install webserver
apt install apache2

# install php
apt install php7.4 libapache2-mod-php7.4

# restart webserver
service apache2 restart

# make sure php works
vim /var/www/html/info.php
# fill with

# then point browser to

one should see something like this:

this just means php works with apache2.


time for one’s first celebration dance!

install more stuff: (might be optional)

# search what packages are there for this version of php
apt search php7.3
apt search php7.4
apt search php8

# install only those php addons, that are absolutely needed
apt install php7.4-mysql php7.4-curl php7.4-gd php7.4-intl php-pear php-imagick php7.4-imap php-memcache php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-mbstring
# php7.4-recode does not exist anymore
service apache2 restart

# phpmyadmin is still a pretty nice web based

# mysql-mariadb management gui

mysql --version; # tested with
mysql Ver 15.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

# mariadb main config file should be there

# enable logging
# create dir
mkdir /var/log/mysql
# as mariadb is running as non-root user mysql give it access
chown -R mysql: /var/log/mysql
# modify config file
echo "[mysqld]" >> /etc/mysql/my.cnf;
echo "general_log = 1" >> /etc/mysql/my.cnf;
echo "general_log_file = /var/log/mysql/mariadb.log" >> /etc/mysql/my.cnf;

# monitor the log
tail -f /var/log/mysql/mariadb.log
systemctl restart mariadb

# if logging works and service is restarted it should show
==> /var/log/mysql/mariadb.log <== 
/usr/sbin/mariadbd, Version: 10.11.6-MariaDB-0+deb12u1-log (Debian 12). started with: 
Tcp port: 0 Unix socket: /run/mysqld/mysqld.sock 
Time Id Command Argument 
240503 18:58:03 3 Connect root@localhost on mysql using Socket 
3 Connect Access denied for user 'root'@'localhost' (using password: NO) 
4 Connect root@localhost on using Socket 
4 Connect Access denied for user 'root'@'localhost' (using password: NO) 

# make sure its up and running
service mariadb start
service mariadb status
systemctl enable mariadb
# before one can login as root:root (creditz)
# run the init

# login into mariadb
# the "new" mysql (that's why it is still called mysql)
mysql -u root
# if that fails try (and give root pwd)
mysql -u root -p

# copy and paste those commands:
use mysql;
update user set plugin='' where User='root';
flush privileges;

# how to reset mariadb root password
service mariadb stop
mysqld_safe --skip-grant-tables --skip-networking
[1] 12154
240503 18:25:56 mysqld_safe Logging to syslog.
240503 18:25:56 mysqld_safe Starting mariadbd daemon with databases from /var/lib/mysql

# leave this terminal1 open and open another terminal2
mysql -u root
# run those commands
ALTER USER 'root'@'localhost' IDENTIFIED BY 'EasyToGuessPassword'; FLUSH PRIVILEGES

# go back to terminal1
# try to quit mariadb with Ctrl+C
# but it won't listen
# not sure if that's a good idea but it works X-D
killall -9 mysqld_safe
# and
killall mariadbd

# restart mariadb
systemctl restart mariadb.service

# how to repair a corrupt broken table: 
# it's not so easy, as the error message does not say in what database the table is in
# Error occurred: (1034, "Index for table 'proc' is corrupt; try to repair it")

systemctl stop mysql
cp -r /var/lib/mysql /var/lib/mysql_bkp
systemctl start mysql

mysql -u root -p
USE mysql;
# based on this
cd /var/www/html

(sha512sum ded55db84f54e51429cf6463a5ade5b5b1859d6b917d340ccf265e6860381d80f6d62eacc29672280574c21f95d77cb14c649b1f8e000d34cd9a85514d06765e)


mv -v phpMyAdmin-5.1.0-all-languages phpmyadmin

cd phpmyadmin

mv -v

# setup config
# search for this line and change this value
cfg['blowfish_secret'] = 'root'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

chmod 660 /var/www/html/phpmyadmin/

chown -R www-data:www-data /var/www/html/phpmyadmin

systemctl restart apache; # debian10 restart apache 2 service 

service apache2 restart; # ubuntu20 restart apache 2 service
# point browser at http://localhost/phpmyadmin, should be greeted with this login:

# btw did the dev-user know, one can create user+database in "one go" like this:

# or try the alternative: "adminer"
cd /var/www/html
mv adminer-4.7.6.php adminer.php

xdebug + pdt eclipse for php:

mkdir /software
cd /software

# download eclipse

# 2022-03
wget -O eclipse-php-2020-06-R-linux-gtk-x86_64.tar.gz
tar fxvz eclipse-php-*.tar.gz;
# set user rights, so non-root user can use /software
chown -R user: /software
# install xdebug
apt install php-xdebug

# probably optional:
# alternative compile from latest source way of installing xdebug
apt install php-dev
pecl install xdebug

would replace firefox-esr with firefox

mkdir /software
cd /software
tar fxv firefox-76.0.tar.bz2

cd /usr/bin
# unlink firefox-esr (default debian 10 firefox version)
unlink firefox
# create new link to latest manual download firefox 76
ln -sv /software/firefox/firefox

start and config eclipse:

eclipse is a bit complex. one has been warned X-D

# start eclipse pdt

let eclipse know where php (go to terminal and type: which php) and php.ini (can be found in info.php) is:

and it shall use xdebug as default debugger:

xdebug settings:

enabling Xdebug:

this is absolutely essential (or eclipse will hang with “waiting for xdebug session…” forever and ever…)

enabling Xdebug in Debian 10: add the following to /etc/php/7.3/mods-available/xdebug.ini:

cat /etc/php/7.3/mods-available/xdebug.ini
xdebug.profiler_enable_trigger = 1
xdebug.profiler_enable = 0
xdebug.remote_enable = 1
xdebug.profiler_output_dir = "/tmp"

Restart Apache:

service apache2 restart;


pray! and run! X-D

if everything works as planned one can start a debug session like this:

eclipse start firefox with url problem:

if one wants to use external browser firefox, there might be a problem: firefox should launch one’s whateverfilename.php with the ?XDEBUG_SESSION_START parameter…

if not and xdebug “hangs” with “waiting for xdebug session…”

then open a terminal and check if firefox was not starting correctly (starts in background than crashes X-D)

ps uax|grep firefox

(eclipse tries to open firefox via: -openURL(%URL%) but does not seem to work (anymore?), guess it is a eclipse specific problem, eclipse could just start /usr/bin/firefox %URL% should work)

# example, firefox 78.7.0esr (64-bit) does not seem to like to start like this anymore
firefox-esr -remote openURL(http://localhost/project/index.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=16136735518102)

workaround: use the default settings (eclipse’s internal browser)

so instead of: tell eclipse to use firefox external browser

just go with the eclipse internal browser:

in the vm: have added firefox to external tools or manually opening firefox with XDEBUG_DESSION_START=KEY works too.

expected result:

… eclipse should “pause” / report that a debug session has started and freeze at the first line of php code: 🙂 (F5 -> step step, F8 -> keep running)



one can now very nicely step debug all sorts of php requests DIRECTLY on the server.


have nothing seen like this anywhere else! (although it is said that c programs could be remote debugged with gdb, but that is an art in itself X-D)





hereby creditz shall be given to Larry_Ewing for creating the Tux Logo can download the whole vm here:

once it runs: get meaningful php debug error warning output

it is not always “clear” where php will output the errors & warnings…

for example: the function split is DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0

and needs to be replaced with “explode” (this is kind of the annoying stuff about php updates… they keep changing function names, but usually only minor changes to “has worked before” php code have to be made)

the file.php simply “quits” without warning or error when split is called

so there is per default no error output in the browser unless…

# put this on the very top of file.php to enable errors & warnings in browser
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
  1. the developer puts at the very top of the file.php
  2. the developer modifies php.ini
    • but then still… it does not output in browser but in log file! (this script is very helpful in finding that log file)
    • so… if the developer runs GNU Linux Debian 10 + apache2 + PHP7 the /var/log/apache2/error.log is the file where errors and warnings are written to/logged
    • a simple tail -f /var/log/apache2/error.log does the job too 🙂

      • (but it is usually more convenient having development & errors displayed all in the same window… not having to switch back and forth… okay here come two-monitor solution in to play (have browser on right monitor, and eclipse dev environment on left monitor)

improving handling: shortcuts & hotkeys

when tasks have to be repeated very often… clicking around in menus and sub-menus costs a lot of time (every millisecond counts 🙂

to start debug session:

to stop debug session:

note: want to work with firefox?

the developer does not need to restart (Ctrl+F2, wait, complicated hotkey) the debug session, after code changes, just hit F5 in firefox (it is basically a “hot reload”)

Downloads READY 2 GO VirtualBox VM 🙂

neat service for you, virtualbox has the advantage of running cross platform, windows, osx, GNU Linux so all vms can be run on all (major) OS:

Oracle Virtualbox VM: Debian10 + LAMP + PHP7.3 + XDebug + MariaDB + Adminer + Eclipse PDT

1) install


2) simply double click the devphp_xdebug_Debian10_.vbox should import the vm and user should be able to run immediately

so filesize wise xz compresses better than bzip2 which compresses better than gzip, so xz (J) was used:

# archive was created like this
tar fcvJ devphp_xdebug_Debian10_.tar.xz devphp_xdebug_Debian10_;
sha512sum devphp_xdebug_Debian10_.tar.xz > devphp_xdebug_Debian10_.tar.xz.sha512sum.txt;

# check integrity
sha512sum -c devphp_xdebug_Debian10_.tar.xz.sha512sum.txt
# unpack
tar fxvJ devphp_xdebug_Debian10_.tar.xz

project management:

===== project management
all projects are stored on host (directly on hardware) in folder /projects or /home/user/projects

host will do git management (commit)

vm will mount the host’s project folder (it’s a bit complicated, because of access-rights permission problems (webroot default user www-data)

=== project access on vm

1) configure “shared folder” to share host-folder “projects” (where projects shall be stored on host) with vm

2) bindfs to /var/www (default web root apache & xdebug workspace)

two scripts are used (on startup, activate rc.local)


# bind projects into workspace
/scripts/ projectName1
/scripts/ projectName2


# mounts PROJECTNAME into apache2 default web root/user's workspace /var/www/html
PROJECT=$1; # specify projectname
# create mountpoint
mkdir -p /var/www/html/$PROJECT;
# bind-mount project as www-data:www-data
bindfs -u 33 -g 33 /media/sf_projects/$PROJECT /var/www/html/$PROJECT/;


buy him many cups of coffee!->

inspiration was also taken from:


thanks all involved! GREAT JOB!

from user to dev:

  • the positive:
    • php is easy to learn
    • php is usually “fast enough” (for web backends: it is slower than java but faster than python, but java needs A LOT more RAM)
  • the critique:
    • php related environments might be a wee bit complicated to setup
  • if the user wants to become a php dev check out bro’s excellent fun and easy php examples 🙂
    • just4info:
      • all those fancy php frameworks symphony sometime consisting of more than 10.000 files (thanks for making it open source but that’s a wee bit against unix kiss)
      • are just libraries that a dev wrote to use it, and while it HIGHLY might advance the user-soon-php-dev php-related-career they are NOT REQUIRED to get started, also:
        • if the user-soon-php-dev writes libraries + uses xdebug, the user-soon-php-dev is the only one who REALLY understands whats going on “under the hood” why things work or fail

keep it up and running:

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!