Debian Tutorials

Debian Tutorials


Step by step tutorials showing you how to install and configure various applications and services on Debian based Linux distros.

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories


How to install LAMP (Apache, PHP and MySql in Linux)

Ástþór IPÁstþór IP
Please note! This tutorial is outdated and won’t work on the latest Debian releases. Here’s a detailed tutorial on how to set up LAMP on Debian Linux 9 (Stretch): How to set up a web server (LAMP) on Debian 9 (stretch)

Compatibility

This tutorial has been tested on the following Linux distributions:

Debian Linux 5 (Lenny)

Last updated:
7th of April 2018

Trac
Here’s a basic guide on how to get Apache2, PHP5 and MySql working on most Debian based distros in a few easy steps.

1. Install Apache2 and PHP5 (as an Apache module)

apt-get install apache2 php5 libapache2-mod-php5 php5-mysql

2. Install MySql server

apt-get install mysql-server

3. At this point you may need to restart Apache

/etc/init.d/apache2 restart

3. Create a test php file

echo "<?php phpinfo(); ?>" > /var/www/info.php

The default document root for Debian is in /var/www so you can access the test file on this location: http://yourserver/info.php

3. Install phpMyAdmin (optional but preferred by most developers and administrators)

apt-get install phpmyadmin

By default, phpmyadmin will be accessible on: http://yourserver/phpmyadmin

Comments 4
  • chet
    Posted on

    chet chet

    Author

    Thanks for this. Am using Squeeze2 and had to add some repositories to /etc/apt/sources.list. works like a champ now.


  • chet
    Posted on

    chet chet

    Author

    To access the phpmyadmin login I had to add

    Include /etc/phpmyadmin/apache.conf

    to the end of /etc/apache2/apache2.conf

    and then restart apache2 (/etc/init.d/apache 2 restart)


  • Eddie
    Posted on

    Eddie Eddie

    Author

    Hello,

    I can’t access the phpmyadmin in my squeeze with ISPConfig 3 – the same thing happens to me when I try to access squirrelmail from a domain – a security popup box appears about downloading the file “phpmyadmin” or “webmail” – I don’t understand this – is it a permissions thing, and if so, what files do I chmod?

    In any case I tried your fix, above, and I received the following waning when I restarted apache2:

    The alias directive in /etc/phpmyadmin/apache.conf at mine 3 will probably never match because it overlaps an earlier alias.

    In any case, your ix worked, and I thank you. I can now login. Do you think the same instructions, modified, would allow me to access each individual domains’ webmail at domain.com/webmail ?


  • Willow Wright
    Posted on

    Willow Wright Willow Wright

    Author

    I am using the newest software, and yet get a 404 error when attempting to access the phpmyadmin login.