Skip to content

Instantly share code, notes, and snippets.

@hawkup
Last active August 29, 2015 14:23
Show Gist options
  • Save hawkup/852341e62860a2b4b8f4 to your computer and use it in GitHub Desktop.
Save hawkup/852341e62860a2b4b8f4 to your computer and use it in GitHub Desktop.
Install PHP Mysql Apache2 and Phpmyadmin on ubuntu 14.04

Apache2

sudo apt-get update
sudo apt-get install -y apache2
  • if you can not start apache2 service and get this message
apache2: Could not determine the server's fully qualified domain name, 
using 127.0.0.1 for ServerName
  • create directory and file
sudo nano /etc/apache2/conf.d/fqdn
  • add this and save then start service again
ServerName localhost

reference: http://askubuntu.com/questions/256013/could-not-reliably-determine-the-servers-fully-qualified-domain-name

Mysql

sudo apt-get install mysql-server php5-mysql

sudo mysql_install_db
sudo mysql_secure_installation
  • if you has this problem ' mysql-server : Depends: mysql-server-5.5 but it is not going to be installed'
http://askubuntu.com/questions/489815/cannot-install-mysql-server-5-5-the-following-packages-have-unmet-dependicies
  • problem can not solve install mysql-server-5.6 instead
sudo apt-get install mysql-server-5.6

PHP

  • uninstall previous version
sudo apt-get -y purge php.*
  • install PHP 5.6
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
  • install PHP 5.5 (If you use ubuntu 12.04 this will install PHP 5.4)
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
  • open /etc/apache2/mods-enabled/dir.conf
sudo nano /etc/apache2/mods-enabled/dir.conf
  • and change to this
<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
  • and then restart apache2
sudo service apache2 restart

Phpmyadmin

sudo apt-get update
sudo apt-get install phpmyadmin
sudo php5enmod mcrypt
sudo service apache2 restart
  • if http://{ip_address}/phpmyadmin is not found
sudo ln -s /usr/share/phpmyadmin /var/www/ # or /var/www/html
  • open /etc/apache2/apache2.conf
sudo nano /etc/apache2/apache2.conf
  • add this line
Include /etc/phpmyadmin/apache.conf
  • restart apache2

  • If u not set password for login phpmyadmin open /etc/phpmyadmin/config.inc.php.

sudo nano /etc/phpmyadmin/config.inc.php.
  • remove comment this line
// $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

reference: https://serversforhackers.com/video/lemp-on-ubuntu https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04 https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-14-04 http://askubuntu.com/questions/387062/how-to-solve-the-phpmyadmin-not-found-issue-after-upgrading-php-and-apache http://serverfault.com/questions/144095/phpmyadmin-on-ubuntu-lamp-login-without-a-password-is-forbidden-by-configurat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment