in MySQL, Web

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

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

Write a Comment

Comment

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

  2. 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)

  3. 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 ?

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