phpMyAdmin on a Vagrant LAMP

I’ve been away from PHP nearly four years, I’ve been working in javascript and Node.JS instead. I have a memory of what tools I was comfortable working with… it’s a rusty memory how it all went together. I’ve followed Vagrant Crash Course
and have connected from MySQL WorkBench.

I’d like to use PHPAdmin, Do I need to add it to the bootstrap file or is it an external connection like the workbench?

# Update Packages
apt-get update
# Upgrade Packages
apt-get upgrade

# Basic Linux Stuff
apt-get install -y git

# Apache
apt-get install -y apache2

# Enable Apache Mods
a2enmod rewrite

#Add Onrej PPA Repo
apt-add-repository ppa:ondrej/php
apt-get update

# Install PHP
apt-get install -y php7.2

# PHP Apache Mod
apt-get install -y libapache2-mod-php7.2

# Restart Apache
service apache2 restart

# PHP Mods
apt-get install -y php7.2-common
apt-get install -y php7.2-mcrypt
apt-get install -y php7.2-zip

# Set MySQL Pass
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'

# Install MySQL
apt-get install -y mysql-server

apt-get install -y php7.2-mysql

# Restart Apache
sudo service apache2 restart


# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # Box Settings = "ubuntu/trusty64"

  # Provider Settings
  config.vm.provider "virtualbox" do |vb|
    # vb.memory = 2048
    # vb.cpus = 4

  # Network Settings
  # "forwarded_port", guest: 80, host: 8080
  # "forwarded_port", guest: 80, host: 8080, host_ip: "" "private_network", ip: ""

  # Folder Settings
  config.vm.synced_folder ".", "/var/www/html", :nfs => { :mount_options => ["dmode=777", "fmode=666"] }
  config.vm.provision "shell", path: ""

vagrant_LAMP on

You would need to download and install it, yes. It’s a website that runs on PHP.

In my opinion though you would be better of with an alternative like indeed MySQL workbench, HeidiSQL, SqlYog, etc.

Also, almost nobody runs PHP on Apache anymore, almost everyone is using PHP-FPM with Nginx. Which is faster and a lot easier to configure that Apache.

Lastly, when your gets too big, I would recommend looking at Ansible to provision the server, where you can cut it up into several re-usable pieces that fit together. It scales much better than a bash script.

Don’t get me wrong, a bash script is fine for now, Ansible is just a suggestion for when you grow out of it :slight_smile:

This works really well for setting up a vagrant environment suitable for php dev.

I also would recommend a tool like Workbench, SQlDeveloper, etc. However, I prefer the JetBrains product database integration. I haven’t really used anything but that for several years.

Using any of the apps mentioned you can ssh into the box and connect to the db through an app located on your host machine.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.