How to setup phpmyadmin on a Laravel Homestead box

2019-01-29 16:58发布

I installed it by running sudo apt-get install phpymyadmin and then running

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html and sudo service nginx restart

but it's not working.

note: I didn't select any of apache2 or lighttpd options when installing.

14条回答
smile是对你的礼貌
2楼-- · 2019-01-29 17:38

You can install phpmyadmin automatically when you vagrant up or provision your homestead by adding the following snippet to your Homestead\scripts\homestead.rb file after # Update Composer On Every Provision

# Install phpMyAdmin on every provision
    config.vm.provision "shell" do |s|
      s.inline = "curl -sS https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh | sh"
    end

Your hoomestead.rb file should now look somehow like this

class Homestead
  def Homestead.configure(config, settings)
    # Configure The Box
    config.vm.box = "laravel/homestead"
    config.vm.hostname = "homestead"

    # Configure A Private Network IP
    config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"

some other entries are truncated to keep this short

    # Update Composer On Every Provision
    config.vm.provision "shell" do |s|
      s.inline = "/usr/local/bin/composer self-update"
    end

    # Install phpMyAdmin on every provision
    config.vm.provision "shell" do |s|
      s.inline = "curl -sS https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh | sh"
    end

    # Configure Blackfire.io
    if settings.has_key?("blackfire")
      config.vm.provision "shell" do |s|
        s.path = "./scripts/blackfire.sh"
        s.args = [settings["blackfire"][0]["id"], settings["blackfire"][0]["token"]]
      end
    end
  end
end

Save file and run vagrant destroy then vagrant up or just vagrant reload

NB: This uses Nikos Gr script located here https://raw.githubusercontent.com/grrnikos/pma/master/pma.sh

查看更多
ら.Afraid
3楼-- · 2019-01-29 17:43

I installed phpMyAdmin from here

then put these settings in config.inc.php:

/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '33060';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

and opened via Apache (I had a xampp). In my case i placed phpMyAdmin in D:\xampp\htdocs\pma which allowed me to open at localhost/pma url.

Everything worked!

查看更多
登录 后发表回答