Install LAMP Stack (Apache, MariaDB, PHP, phpMyAdmin) on LinuxMint 17.1, 17.2, 17.3 & 18

4) PHP installation

Use the below command to install PHP. PHP initially called Personal Home Page, now it is called asHypertext Preprocessor. PHP is a open source software which is designed for web development purpose. It is used for server-side scripting language as well as general-purpose programming language.

[Install php5 old systems]
$ sudo apt-get install php5 php5-mysql libapache2-mod-php5 php5-mbstring php5-common php5-gd php5-mcrypt php-gettext php5-curl php5-cli

[Install php7 for Mint 18]
$ sudo apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-mbstring php7.0-common php7.0-gd php7.0-mcrypt php-gettext php7.0-curl php7.0-cli

Create test php file to check whether php is working with apache or not.

[Creating php info file]
$ sudo nano /var/www/html/phpinfo.php
<?php phpinfo(); ?>

[Restart apache service]
$ sudo systemctl restart httpd.service

Open your web browser and navigate to http://localhost/phpinfo.php or http://your-server-ip-address/phpinfo.php or http://127.0.0.1/phpinfo.php
install-lamp-on-linuxmint-18-sarah-3

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

24 Comments on “Install LAMP Stack (Apache, MariaDB, PHP, phpMyAdmin) on LinuxMint 17.1, 17.2, 17.3 & 18”

  1. Thank you Magesh,
    I use this article as my go-to when installing a LAMP setup.
    It works perfect.
    I particularly like that you go through the MariaDB setup as well.
    Would like to get it as a pdf just in case this website ceases.

  2. Good walkthrough, but the phpMyadmin doesn’t work. A bit lost with the suggestions in the comments. Also, I picked up another walkthrough so I have MySQ installed rather than MariaDB.

    1. Open terminal si copy paste this line

      This works for all distros…

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

  3. Hi, I’ve done everything as you’ve said. Everything is working fine, or at least I think so, except phpmyadmin.
    I’m getting 404 Not Found error when I check out http://localhost/phpmyadmin
    Any idea what may be causing it and on how to get rid of it?

    1. Hey, I got this from Linux Mint community. Apparently, we need to configure apache2.conf to work with Phpmyadmin, and then restart apache.
      sudo gedit /etc/apache2/apache2.conf
      Include /etc/phpmyadmin/apache.conf

      sudo /etc/init.d/apache2 restart

      Anyway thank you for taking time out and to put up this post. 🙂

        1. I need to do the same for being able to access to phpmyadmin.

          I follow all the instruction (I’ve done it twice – working on a VM to be sure) and I always get a problem of right between Phpmyadmin & MariaDB

          When i want to do something I get this in phpmyadmin
          #1044 – Access denied for user ‘phpmyadmin’@’localhost’ to database ‘Joomla’

          could You help me?

    1. Thanks for the answer, but as I mention before I’m new at linux, can you point me in the right direction where I can check what ‘ “systemd” daemon ‘ means. Thanks for the help.

    2. After some research now I know what you were talking about Mint 18 ported with “systemd”. All is working now. Thanks.

      Thumbs up for this Article.

  4. Thanks for the time to post this tutorial, amazing help for newbies like me.
    I have couple issues with some of the instructions, can somebody help please.
    I have a fresh installation (Mint 18 Sahara 64-bit, Kernel 4.4.0-21-generic x86_64, MATE 1.14.1)

    First issue with Apache:
    $ sudo chkconfig httpd on
    I got: chkconfig: command not found ,
    I just ignored 🙁 , and I was abble to access the Apache page at 127.0.0.1

    At mariaDB:
    [Start, enable & status checking Sysvinit System]
    $ sudo service mysqld start
    I got: failed to start mysqld.service: Unit mysqld.service not found
    didn’t try the next two instructions after that message.

    I continued to nex instruction: mysql_secure_installation,
    at root password question when I press ENTER it said: Access denied for user ‘root.localhost’ and keeps asking for it.

    Thank you …

  5. Awesome content mate. I appreciate the write up, had to do a bit of digging with google to find this, but it’s exactly what I needed for my new install of mint 18.

  6. If phpmyadmin does not start add: Include /etc/phpmyadmin/apache.conf
    at the end of apache2.conf in etc/apache2/
    and restart apache
    also you can change the localhost directory from www/html to just www or other in httpd.conf
    that is in etc/apache2/sites-enabled

    Used to install Bitnami Lamp with less clicks
    But I think this is better and run at startup, thanks

Leave a Reply

Your email address will not be published. Required fields are marked *