Comments on Debian 9 LAMP Server Tutorial with Apache, PHP 7 and MariaDB

LAMP is short for Linux, Apache, MySQL, PHP. This tutorial shows how you can install an Apache web server on a Debian 9 (Stretch) server with PHP (mod_php) and MySQL / MariaDB support. A LAMP setup is a perfect basis for CMS systems like Joomla, Wordpress or Drupal.

21 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: ejjus

Step 8 doesn't work without :

A cleaner way is to create the new configuration file:

/etc/apache2/conf-available/phpmyadmin.conf

and write the following in it:

Include /etc/phpmyadmin/apache.conf

then, soft link the file to the directory /etc/apache2/conf-enabled:

sudo ln -s /etc/apache2/conf-available/phpmyadmin.conf /etc/apache2/conf-enabled

By: till

What you described is necessary just in case you missed selecting "Apache2"  in the first apt dialog from Stp 8 shown in this tutorial. The better and easier way is to just follow the tutorial and select 'Apache2' when apt ask you which web server shall be configured.

By: ejjus

I actually came back to add that I might have wrongfuly selected or typed something. It definetally is a misstep on my part, because I struggled with some server internal things for 5 or 6 hours prior to setting up LAMP. I should have worded my first comment differentely, more like in the format of "In my case..."

Have a nice day.

By: ejjus

I didn't try the echo on the last step. This did the same:

 

Maybe a bit late, but I found this answer looking over the internet. It could help others with the same problem.

$sudo mysql -u root

[mysql] use mysql;

[mysql] update user set plugin='' where User='root';

[mysql] flush privileges;

[mysql] \q

Now you should be able to log in as root in phpmyadmin.

Nice tutorial. Helped me a lot. Cheers.

By: Michael Guldhammer

Run theese 2 commands again, it works for me.

systemctl start mariadb mysql_secure_installation

By: Hopy

in file info.php

You forget ?>

By: till

I don't forgot it, the closing ?> is not required anymore in current PHP versions. Try it out, you will see it works without it :)

By: Vassilis

Thank you for your sharing and your secure setup. I have just installed this for a new website development on a debian9 LXC container through proxmox, everything works perfect. thank you again

By: jim

While I do appreciate Till's site and sharing... I'm not sure this should be considered a "secure setup."

AppArmor/SELinux is disabled, access to MariaDB beyond localhost, root access to phpMyAdmin/SSH, no key pair access, etc.

A series of articles entitled "Secured Perfect Servers" might be interesting.

By: Patrice

Works like a charm ! 

 

Many thanks :) 

Pat

By: Baptiste

Hello

( Sorry i'm french )

 

I have been follow your tutorial but on the step 8 at the end Phpmyadmin not work

https://i.imgur.com/XbeTOte.pngI don't know why .... can you help me pls

 

Thanks ^^

By: Abdurakhman

so i fixed by this command

sudo ln -s /usr/share/phpmyadmin /var/www/html/

By: till

The error means that you did not select "apache" as described in the tutorial when the phpmyadmin installer asked you "Web server to reconfigure automatically". You can redo the phpmyadmin configuration with the command dpkg-reconfigure phpmyadmin

Ensure to select apache2 by navigation to that point with the tab key on your keyboard and then select it with the space key. If you miss to select it with space, then the option is not used by apt and phpmyadmin will not get activated for apache.

By: Leilf Falkenstrom

Very good and clear instruktion, but I would recommend that the instruktions updates to install a newer version of php because Joomla will soon stop supporting that old version. When update you might update the path for joomla too as it have got closer to version 4 (3.8.14 today)

Now when most webb sites use https would it be nice for that to be included in the guide too.

By: Gilson

 Prob: phpmyadmin: "Access denied for user 'root'@'localhost'"

I followed the instruction but cannot login to phpmyadmin. I tries both, the echo code and the "

$sudo mysql -u root

[mysql] use mysql;

[mysql] update user set plugin='' where User='root';

[mysql] flush privileges;

[mysql] \q"

But didn't work.

So, how can I solve this? Paword root phpmyadmin...

 

Thank

By: sky

Nice tutorial

Helped me a loot

Many thanks

:D

By: piotao

on fresh debian install, the step 2 is NOT WORKING, because there apparently IS the password in root account set in the database, so:

Enter current password for root (enter for none): <-- Hit return DO NOT WORK.

By: till

Step 2 is working fine as it is. I've installed it on a fresh Debian system today, no default password was set there. It might be thought that you used a different base system from an ISP which had MariaDB installed and therefore a password was set already, in that case, you should enter the password that you had set when the command requests it.

Please don't claim that a step is wrong just because your particular server as a different preset of applications than a default empty Debian server.

By: Gustavo

Hola Till, muchas gracias por tu aporte, muy útil.

Yo tengo una Raspberry Pi 3 y de vez encuando reinstalo el Raspbian (cuando empiezo a tener problemas de lentitud entre otras cosas), como estoy aprendiendo PHP, HTML y MARIADB también instalo LAMP y así ir familiarizandome con los software.

Mi problema comienza cuando instalo PHPMYADMIN, siempre, siempre tengo problemas al ejecurtarlo no me reconoce el USUARIO ni el PASSWORD, me he guiado con una página distinta cada vez que instalo el paquete y siempre lo mismo, a la hora de acceder a PHPMYADMIN el mismo resultado incluyendo tu tutorial.

Los mensajes que me da PHPMYADMIN son:

1.- #1698 - Access denied for user 'root'@'localhost'

2.- mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'

Cabe señalar que cada vez realice los pasos lo hice al pie de la letra y debo buscar tutoriales más invasivos con el software para poder romper la barrera que impide ingresar a la primera.

By: Kachro

Installed Apache2 and PHP7.0 on Debian 9 (Stretch). I left out the phpMyAdmin for a later date, once I understand the security aspects better.

Went smoothly. Thanks for the clear instructions!

By: Tom Travis

I would love to see his updated using PHP8.1 or whatever the latest version is.  It took me some stumbling around but I got it to work:

*

mysql_secure_installationnow asks whether you want to switch to unix socket authentification. I chose NO. Step 9 throwing an error: ERROR 1356 (HY000) at line 1: View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them. This is where I fumbled around and got it to work, maybe because I tried entering the commands from the earlier comment below.