Skip to content

Instantly share code, notes, and snippets.

@ratiw
Last active February 13, 2020 11:18
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save ratiw/1428d432877d745aa49d to your computer and use it in GitHub Desktop.
Save ratiw/1428d432877d745aa49d to your computer and use it in GitHub Desktop.
#Laravel #Homestead on #Windows

Problem with VirtualBox 4.3.12

It seems there is some problems between Vagrant 1.6.2 and VirtualBox 4.3.12 (the latest at the time or writing this), switching back to VirutalBox 4.3.6 or VirtualBox 4.3.8 seems to eliminate the problem.

update 1: Try both Vagrant 1.6.2 and VirtualBox 4.3.12 on Mac and they seem to work fine!

update 2: You need to enable Virtual Machine option in your BIOS to make VirtualBox work as expected. Saw someone mention about this in Laravel forum about this and it is true.

Also, Vagrant version should be 1.6.2.

Another problem is that the homestead.rb script tries to set the private IP address as 192.168.33.10 192.168.10.10 but for unknown reason the actual IP set in VirtualBox was 192.168.33.1 192.168.10.1. To solve this, open VirtualBox program and go to

File -> Preferences... -> Network 

Select 'Host-only Networks' tab and edit the VirtualBox Host-Only Ethernet Adapter on IPv4 Address: to 192.168.33.10 192.168.10.10

Homestead.yaml

Folder reference in the Homestead.yaml on Windows should be like this:

authorize: c:/Users/username/.ssh/id_rsa.pub

keys:
    - c:/Users/username/.shh/id_rsa

Replace "username" with appropriate username on Windows

Using phpMyAdmin with Homestead box

Once the Homestead vagrant box is installed successfully, we can add phpMyAdmin and config it to run with Nginx.

Install phpMyAdmin

  • SSH into Homestead vagrant box with vagrant ssh and type the following command:
    sudo apt-get install phpmyadmin
  • when prompted to select the Web server, select apache2 and press Enter, just to get pass it.
  • when prompted to config database for phpmyadmin with dbconfig-common, select Yes and press Enter.
  • when prompted for Password of the database's administrative user, enter secret and press Enter.
  • when prompted for MySQL application password for phpmyadmin, enter secret and press Enter.
  • when prompted for Password confirmation, enter secret again and press Enter.

Create and config site for Nginx

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html/phpmyadmin

serve phpmyadmin.app /usr/share/nginx/html/phpmyadmin

Adding phpMyAdmin.app to hosts file

  • Run Notepad as Administrator, then open navigate to C:\Windows\System32\drivers\etc.
  • You may need to type *.* and press Enter in File name box to see it.
  • Select file hosts and click Open button.
  • Add phpmyadmin.app at the bottom of the file like so,
    127.0.0.1   phpmyadmin.app
  • Save the file and close Notepad.
  • Now use Chrome or any Web browser to navigate to http://phpmyadmin.app:8000 and you should now see phpMyAdmin login page.

Creating new User

  • Login to phpMyAdmin as root using password secret
  • Goto tab Users and create a user for your app and set privileges as you see fit.
@eliotis
Copy link

eliotis commented May 23, 2014

This is great bro, thank you so much!

@ChrisBinge
Copy link

Hey, I set this up and it works (I can log into phpmyadmin and create a DB, and it shows the default homestead db) but I am having some trouble with the connection.

[PDOException]
SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

when I try to migrate within SSH. Looked at my database.php and I set the name to both root and homestead and used password of secret, still getting the same error.

@ratiw
Copy link
Author

ratiw commented Jun 8, 2014

@ChrisBinge I'm not sure about your problem, but I usually create .env.local.php in the root app folder and everything is working fine. I think you may try posting your issue on Laravel forum to see if anyone can help on this.

@gherosh
Copy link

gherosh commented Feb 17, 2015

"Using phpMyAdmin with Homestead box" also work on Ubuntu 14.04 with Laravel Homestead version 2.0.9 on virtual box.

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