16

What is the most correct method of installing apache 2 server, php5, mysql and phpMyAdmin?

I installed it this week, and I had a lot problems without solutions, so now that I reinstalled Ubuntu 13.04 I don't want to make the same mistake again.

karel
  • 110,292
  • 102
  • 269
  • 299
L.V.A
  • 1,154
  • 2
  • 14
  • 29

6 Answers6

13

From a command line:

sudo apt-get install tasksel
sudo tasksel install lamp-server

https://help.ubuntu.com/community/ApacheMySQLPHP

NGRhodes
  • 9,380
  • 47
  • 56
  • 3
    Another option is `sudo apt-get install lamp-server^`? – Sithu Oct 22 '14 at 12:25
  • I installed `lamp-server^`. Does it include phpMyAdmin? How can I access it from browser? – Sithu Oct 22 '14 at 12:57
  • 1
    `sudo vi /etc/apache2/mods-available/php5.conf` and comment the line that says `php_admin_flag engine Off` "DO NOT MAKE IT ON JUST COMMENT IT OUT" – juggernauthk108 Apr 26 '16 at 19:43
  • @Sithu, cross-reference [this AU post](https://askubuntu.com/questions/785440), and specifically [this comment](https://askubuntu.com/questions/785440/how-to-install-lamp-server-on-ubuntu#comment1178103_785443) about the caret ('`^`'). I quote, "`tasksel` is no longer needed. `sudo apt-get install lamp-server^` will activate the "task" (mind the carret[sic]: that is used to tell `apt-get` to install the task). – Rinzwind | Jun 10, 2016 at 20:40".The comment refers to not needing `sudo apt-get install tasksel`>`sudo tasksel`>..., but rather, `sudo apt-get install lamp-server^` – bballdave025 Aug 12 '23 at 17:26
11

Install Apache2

sudo apt-get update

sudo apt-get install apache2

sudo apt-get install php mysql-server mysql-client php5-mysql libapache2-mod-auth-mysql php-mbstring php5-gd libapache2-mod-php5


sudo mysql_install_db

Set password for mysql

sudo /usr/bin/mysql_secure_installation

Then install the php

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

sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Then to check the PHP

sudo vim /var/www/info.php

<?php
phpinfo();
?>


sudo /etc/init.d/apache2 restart

Install phpmyadmin

apt-get install phpmyadmin

While installation it will ask for some settings for choosing apache server or lighthttpd choosem apache

Choose Apache

Choose no for dbconfig-common

Now Navigate to the Web Browser and openup the IP mentioned with /phpmyadmin/

eg : http://192.168.122.69/phpmyadmin/

Use Your Login what u used for mysql installation

Login Information I always use for demo purpose is

root and password is admin123

Babin Lonston
  • 6,186
  • 1
  • 23
  • 24
  • `vas@LenovoZ580:~/Desktop$ sudo apt-get install php mysql-server mysql-client php5-mysql libapache2-mod-auth-mysql php-mbstring php5-gd libapache2-mod-php5 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package php E: Unable to locate package php-mbstring` – L.V.A Oct 15 '13 at 16:12
  • 1
    Remove the php-mbstring and install using other – Babin Lonston Oct 16 '13 at 05:19
1

The quickest and my favorite is - open the terminal and type

sudo apt-get install lamp-server^ phpmyadmin
chesedo
  • 1,689
  • 14
  • 25
1

I've developed some steps to install php 5.3 + Apache on Ubuntu 14.

First, write the following repositories to the file /etc/apt/sources.list.d/ubuntu-old.list

deb http://55.archive.ubuntu.com/ubuntu/ trusty main
deb http://security.ubuntu.com/ubuntu precise-security main universe
deb http://cz.archive.ubuntu.com/ubuntu precise main universe

run apt-get update and then

sudo apt-get install php5=5.3.10-1ubuntu3.19 php5-cli=5.3.10-1ubuntu3.19 php5-common=5.3.10-1ubuntu3.19 libapache2-mod-php5=5.3.10-1ubuntu3.19 apache2=2.2.22-1ubuntu1.9  apache2-mpm-prefork=2.2.22-1ubuntu1.9 apache2.2-common=2.2.22-1ubuntu1.9 apache2.2-bin=2.2.22-1ubuntu1.9 php5-pgsql=5.3.10-1ubuntu3.19 php5-xdebug=2.1.0-1

I've tested each command, it worked fine!

s_bighead
  • 111
  • 2
1
  1. ALWAYS

    sudo apt-get update
    
  2. Basic:

    sudo apt-get install apache2 php5-common mysql-server libapache2-mod-auth-mysql php5-mysql
    
  3. Extras:

    sudo apt-get install php5-dev php5-gd
    
  4. Make sure you ALWAYS run mysql_secure_installation after you have installed MySQL
A.B.
  • 89,123
  • 21
  • 245
  • 323
macjules
  • 11
  • 2
0

On Ubuntu 13.10 I had an error installing phpmyadmin:

Errors were encountered while processing:
 javascript-common

When I loaded the page in my browser it came up as:

error: json missing

Found the answer here: https://superuser.com/questions/639945/how-to-fix-the-phpmyadmin-error-json-extension-is-missing.

user241585
  • 101
  • 7