How to Install Apache, PHP, MySQL and PHPMyAdmin in Ubuntu 11.04

If you are a PHP based web developer, you need all the software running and configured properly. Here I am talking about installing them One by One in your Ubuntu Desktop. We are installing all the applications from terminal.

How to Open Terminal:
So, to fire up the terminal follow any of these steps:

  1. If you are running Unity Desktop, click on the Ubuntu Logo at top left corner and type Terminal in the search application bar. Then click on the terminal icon.
  2. If you are running GNome Desktop, click on Applications->Accessories->Terminal
  3. For shortcut, you can also press Ctrl+Alt+T at once, to open the terminal.

 

How to install Apache:

1. Make sure you have the internet connection. To install apache execute the following command in the terminal:

sudo apt-get install apache2

It takes some time to download and install apache. After the setup completes, type http://localhost/ in your browser window to make sure apache is installed and running properly. If you see the page with It Works!, the setup of apache2 completes successfully.

 

How to Install PHP:

1. To install PHP 5, type following commands in the terminal one by one:

sudo apt-get install php5
sudo apt-get install libapache2-mod-php5

The first line installs PHP5 in the computer. The second one provides the PHP5 module for the Apache 2 webserver. If second one is not installed, then Apache cannot parse PHP codes in a web page.

2. After installing PHP5 and PHP module for apache, restart the apache with following code:

sudo /etc/init.d/apache2 restart

3. While restarting the apache server, if you see a warning as “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName”, then you can fix this by creating a file with the Server name. To do this type the following command in the terminal:

sudo gedit /etc/apache2/conf.d/fqdn

When the text editor opens, type “ServerName localhost” inside the file and click Save. Then close it. Now restart again with the above code and you will see that the warning message has gone.

4. Now, we have successfully installed php and apache web server. However, still we don’t know if PHP is successfully installed. To check this, create a file inside /var/www/ folder named test.php as:

sudo gedit /var/www/test.php

and write following code in it

<?php   phpinfo();  ?>

Save the file and type this in browser: http://localhost/test.php

If you see the various information about PHP and installed modules there, then we can confirm that Apache is parsing PHP codes. Hence the installation is successful up to this point.

 

How to Install MySQL:

1. To install MySQL Server in ubuntu, type following code in terminal window:

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

This will install latest mysql server and other necessary PHP modules for recognizing mysql functions from PHP code. While installing MySQL server, you may require to enter the password for MySQL root user.

 

How to Install PHPMyAdmin:

1. To Install PHPMyAdmin, type the following codes in the terminal:

sudo apt-get install phpmyadmin

While installing PHPMyAdmin, you may require to select the web server. In such case, tick the Apache2 Server and proceed with the installation. You may also require to input MySQL root user password during installation.

Once the installation completes, type this in your browser window to confirm the successful installation of PHPMyAdmin: http://localhost/phpmyadmin/index.php.

Now, you are finished. Your environment is setup and you can enjoy using all these applications. Next, you can install other applications that may be necessary such as Eclipse, GIMP etc.

You can leave a response, or trackback from your own site.

15 Responses to “How to Install Apache, PHP, MySQL and PHPMyAdmin in Ubuntu 11.04”

  1. Sushil Gupta says:

    Hey thank you for this post. But I am unable to install the phpmyadmin in my ubuntu 11.04. After installing it by, sudo apt-get install phpmyadmin, it is done but while browsing the location at http://localhost/phpmyadmin it says not found. As again entering the same code sudo apt-get install phpmyadmin says it is already installed. Any help on this? Thank you agian.

    • admin says:

      Hi Sushil,

      First make sure the installation for Apache, PHP and MySQL is successful. If the problem is only with the installation of PHPMyAdmin, then I suggest you to remove it first and then try again with following commands:

      sudo apt-get remove phpmyadmin
      sudo apt-get autoremove
      sudo apt-get install phpmyadmin

      It should work. Thanks.

  2. Jeff says:

    I also get this message

    Not Found

    The requested URL /phpmyadmin/index.php was not found on this server.
    Apache/2.2.17 (Ubuntu) Server at localhost Port 80

    any ideas because I have tried ti reinstall but i doesn’t work yet.

    Thanks

  3. Gordon says:

    I also get this message

    Not Found

    The requested URL /phpmyadmin/index.php was not found on this server.
    Apache/2.2.17 (Ubuntu) Server at localhost Port 80

    any ideas because I have tried ti reinstall but i doesn’t work yet.

    Thanks

  4. Tomaz Kavcic says:

    Hey,

    it looks like Ubuntu 11.04 has broken phpmyadmin installation. There are two options to fix it manually. After installing phpmyadmin (apt-get install phpmyadmin) do one of the following options:

    1.
    vi /etc/apache2/httpd.conf
    Into the file write: Include /etc/phpmyadmin/apache.conf
    Save the file.
    service apache2 restart

    or

    2.
    create a missing symbolic link:
    cd /etc/apache2/conf.d/
    ln -s /etc/phpmyadmin/apache.conf phpmyadmin.conf
    service apache2 restart

    Practically nothing is really broken, it just looks like installation by itself doesn’t implement phpmyadmin configuration into apache2 by default as in previous versions…

    I hope it helps, Tomaz.

  5. snouie says:

    That’s really helpfull, thx bro, I’m so delighted, I hope u could teach me translating the syntax, lol

  6. UBot Review says:

    UBot Review…

    How to Install Apache, PHP, MySQL and PHPMyAdmin in Ubuntu 11.04 | The home of Lalu…

  7. [...] LAMP server Guide Share this:TwitterFacebookLike this:LikeBe the first to like this post. Leave a Comment [...]

  8. Samir says:

    Hi,

    you can also use sudo apt-get install lamp-server^

  9. John says:

    phpMyAdmin not working?

    Scroll up to Gordon’s post on May 29.

  10. Budida says:

    Hey thanks a lot for sharing with us your knowledge, keep it up..enjoy the day..

  11. Cristi says:

    Hello, i have a problem with the phpmyadmin page. It does not load, i get a file that i should download. I used this walk through for the install. Can anybody explain me what shall i do?

  12. John says:

    Very surprising this is still an issue with Ubuntu 12.04.

    If you get a “Not Found” error after doing this, scroll up to Gerald’s post on
    May 29, 2011 at 11:58 am:

    You also need to execute the following additional steps:

    - sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d
    - sudo /etc/init.d/apache2 restart
    - Open your browser and type http://localhost/phpmyadmin/

Leave a Reply

*

Powered by WordPress | Buy cheap cell phones at iFreeCellPhones.com | Thanks to iCellPhonePlans.com, Facebook Games and Free Ads