I am having some trouble getting vagrant/homestead virtual machine to sync up with my real machine.
I am following the laravel homestead guide here: https://laravel.com/docs/5.2/homestead
I think the problem is due to my virtual machine having the directory "Code" and my real machine having the directory "code" (notice the uppercase 'C').
Here is the directories on my virtual machine...
and my yaml file directories
To be honest this is all very overwhelming and the tutorial is so unclear to me as a n00b.
So my question is simple, how to I change the upper-case Code directory on my virtual machine to a lower-case 'code'.
Many thanks in advance.
EDIT:
Here are the steps I am going through...
1: Update my Homestead.yaml as follows
2: I open that command prompt in the ~/Homestead directory and type in the following and nothing has changed!
You map the directories within the Homestead.yaml, under folders
folders:
- map: /Directory/to/your/pc/folder
to: /home/vagrant/code
Related
Symfony project is not running on a remote virtual host because there is no index.php file in the project root directory. When I'm trying to open my symfony project on a localhost with
URL "localhost/symf.com"
it only shows me project folders instead of the home controller. I know I should open my site with Php bin/console server:start command, but how does it work on a remote virtual host?
Perhaps I should somehow change my project's root directory? But I don't have access to remote virtual host configuration
In virtual host you must run prod environment not dev as your localhost. So you must configure your Apache configuration to run your project. Use following link:
Web Server Configuration for Symfony
Be careful, in symfony 3.4 the DocumentRoot is equal to project_path/web and in symfony 4.3 is equal to project_path/public
You mentioned that you do not have access to your virtual host to set one by one configuration. In that case the best way is using docker-compose, so with running docker-compose up -d all the things you need to run your project will be generated automatically. But you must have enough knowledge about docker
Be successful.
Symfony's homepage in at 'YourProject/public/index.php'.
You have to point on this file to see your home controller.
I've combed through similar threads, but none are quite the same issue. I've installed Homestead a handful of times now and seem to always have some kind of issue.
So I've created a www folder on my desktop and cloned the laravel/homsetead in there. I "cd" into www/Homestead and run "bash init.sh" but it created the .homestead hidden folder containing Homestead.yaml, after.sh, and aliases file in my Windows "Users" directory. I can copy/past the files into www/Homestead, edit the Homestead.yaml file accordingly, but then I get a slew of errors when I do vagrant up. Any idea why the init shell file points to that directory and how that could be effecting things?
I resolved this by cloning laravel/homestead in my user directory and adding a /Code folder. init.sh ran fine and vagrant up worked without issue.??????
NONO,it doesn't work for me
I've got a school project and I pushed this to my bitbucket account.
A friend of me needs to pull this project to do some changes and other stuff.
The problem is, whenever he pulls the project and tries to open vagrant, there are no files in his "vagrant ssh".
We tried the 'composer install' for the vendor files.
We got another homestead.yaml file for launching vagrant but it still doesn't seem to fix our problem.
For my part everything works fine, but when my friend pulls the project localy he just can't seem to find any files in his 'vagrant ssh environment'
Homestead.yaml is there for binding the local storage to the virtual environment. Why doesnt he try to do the vagrant ssh first, and then do the pull request inside the shell?
EDIT:
Just try to do things in order. If he followed the instructions for the Laravel installation, his project folder should be something like C:/Project/PHP/Project_name and that route should be specified inside the homestead.yaml file like so:
folders:
- map: C:\Project\PHP
to: /home/vagrant/Code
So it says to bind PHP folder on local disk to virtual folder /code in vagrant.
After that create the project folder inside PHP folder, and pull the files inside, and modify the homestead.yaml once again to bind the project to browser like so:
sites:
- map: project_name.dev
to: /home/vagrant/Code/Project_name/public
And what is left is to modify hosts file to bind that name to the IP address:
192.168.10.10 project_name.dev
He should open the Homestead.yaml and check if the "folders" config reflects the mapping of the project on his machine.
I have tried running the following code, and even though it runs and sets the nginx blocks ok, its not linking to the folder in question with in the host machine.
serve projects.dev /home/vagrant/Code/projects.dev
When i then list the folders within the Code folder on the guest machine, i only get the folders that were created via the automated Yaml config file on init set up.
It seems not be creating the folder and/or linking to it at all with between the guest and host machines
Running it on a iMac OS Mavericks.
Vagrant 1.6.2
VirtualBox 4.3.12
That is strange. What I have is I have a folder mapped on the "folders" section from my host machine that inside contains all the sub-folders for all my projects in progress. So my nginx sites just basically link to the sub-folders inside this directory. If you have something like that it "should" show you the folders from your host inside that Code directory in your VM. Maybe post your YAML file to check it out?
My problem was the new Homestead file, use small c for spelling directory "code".
I was upgrading my homestead, so the old code folder was using capital c, spelled "Code".
I just change my Homeastead.yaml file from calling "code" to "Code".
I have a vagrant box setup running my dev code which is a nginx/php setup.
(Quick info on vagrant - its a virtualbox wrapper: http://www.vagrantup.com/).
In the vagrant/virtualbox setup, it is using linux guest additions to mount a shared folder on my host computer (MAC OSX).
linux guest path: /var/www/local
OSX host path: ~/src/
On multiple occasions, I find that php can't seem to write anything through any command (file_put_contents, fwrite.. etc) to any path location on the mounted shared folder, However it is able to write outside of the /var/www/local (for example /var/www/not-mounted/..).
I find this very difficult to work with, as I am using a cache system and it keeps failing to write any of the cache javascript/css files to (/var/www/local/public/root/cache/) which I need to be in the root folder of my website which is (/var/www/local/public/root/index.php).
I have done a lot of research on this topic:
it seems, the folder mount has the right permissions:
When I type mount command in the linux guest, I get this:
/var/www/local on /var/www/local/ type vboxsf (uid=1000,gid=1000,rw)
Clarify:
This happens all the time, it is a known problem I encounter which I try to workaround.
From cat /etc/passwd:
vagrant:x:1000:1000:vagrant,,,:/home/vagrant:/bin/bash
Can anyone help me on this?
I have figured out the problem.
I have forgot to give PHP the correct user-privileges and permissions to write to the folder. Basically, my PHP user/user-group was www-data/www-data however, vagrant has its own user/group (vagrant/vagrant) which mounts the folder /local/.
Since I did not want to mess with my vagrant mounting behaviour, I just simply changed my php config to start PHP with the user/group - vagrant/vagrant.
This fixed the issue for me.
Thanks for the help!