• +39 334.95.75.404
  • info@robertoaiello.net

How to install lamp server on ubuntu

How to install lamp server on ubuntu

This is the final guide to install lamp server on your ubuntu (every version).

Please follow this step in your terminal:

sudo apt-get install lamp-server^
sudo apt-get install phpmyadmin

ok! Apache server work fine in http://localhost

Your base local directory webSite is : /var/www/html

Create a phpinfo file (phpinfo.php) in /var/www/html :

<?php
phpinfo();
?>

Test the php: http://localhost/phpinfo.php

If you change directory webSite, please follow this step:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/myWebSite.conf

sudo gedit /etc/apache2/sites-available/myWebSite.conf

and insert the new position webSite:

<VirtualHost *:80>

ServerAdmin webmaster@localhost
DocumentRoot /home/my-home/Documenti/www/

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

save the file and close. Edit the apache configuration:

sudo gedit /etc/apache2/apache2.conf

and add:

<Directory /home/my-home/Documenti/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

save and close. Change the permission for this directory:

chmod 775 /home/my-home/Documenti/www/

update and restart apache:

sudo a2dissite 000-default && sudo a2ensite myWebSite

service apache2 reload

OPTIONAL: if you enable php message :

sudo gedit /etc/php/7.0/apache2/php.ini

display_errors = On

Save and close.
If you have ubuntu 16 or later with php7 install :

sudo apt-get install php7.0-xml

robi.aiello@gmail.com

Leave a Comment