Monday 15 July 2013

linux - How to handle files in case-sensitive way in Vagrant on Windows host -



linux - How to handle files in case-sensitive way in Vagrant on Windows host -

on windows 8 i've installed virtualbox + vagrant. used laravel homestead (with ubuntu) box. when running site on vm or running command line expect beingness run on linux , not on windows. found unusual issue:

first folder mappings:

folders: - map: d:\daneaplikacji\easyphp\data\localweb\projects\testprovag\strony to: /home/vagrant/code sites: - map: learn.app to: /home/vagrant/code/my-first-app/public

when run in browser http://learn.app:8000 got right output - page /home/vagrant/code/my-first-app/public same code d:\daneaplikacji\easyphp\data\localweb\projects\testprovag\strony\my-first-app/public clear.

now problem:

in public folder i've created 2 simple files:

file name test (it's empty) , file index.php content:

<?php if (file_exists('test')) { echo "file exists"; } else { echo "file not exists"; }

so run http://learn.app:8000 in browser , output file exists. result wouldn't expect. far know in linux (my box ubuntu) may have files different case in names (in opposite windows) expect got file not exists.

i've tested in vm running php index.php , exact same result file exists 1 time again unexpected.

now did copied 2 files other directory on vm /home/vagrant/tests - directory not mapped using vagrant. when run php index.php file not exists expected result.

to honest doesn't understand it. question - php when using vagrant mapping operating on vm filesystem (in case ubuntu) or on virtual box host filesystem (in case windows). there way create work desired result? know question might bit software related it's connected php , laravel , maybe miss here.

i think issue can solved not using samba or much work.

in windows cmd run:

vagrant plugin install vagrant-winnfsd

it installed plugin nfs windows although @ http://docs.vagrantup.com/v2/synced-folders/nfs.html have clear info nfs doesn't work windows:

windows users: nfs folders not work on windows hosts. vagrant ignore request nfs synced folders on windows.

i modified homestead.yaml file mapping from:

folders: - map: d:\daneaplikacji\easyphp\data\localweb\projects\testprovag\strony to: /home/vagrant/code

to:

folders: - map: d:\daneaplikacji\easyphp\data\localweb\projects\testprovag\strony to: /home/vagrant/code type: "nfs"

(probably if not using homestead.yaml can add together type: nfs, that: config.vm.synced_folder ".", "/vagrant", type: "nfs" in vagrantfile)

now when run

vagrant up

i got 2 or 3 notices admin password (probably windows configuration of nfs - appear when run vagrant up first after adding nfs type) both using url http://learn.app:8000 got case question file not exists , same when run php index.php in box commandline.

note: solution doesn't create can create test , test files in same directory , have them in file system. seems handle file in case sensitive way, if create file in wrong case in app (and later in code want load it/require) notice doesn't work on vagrant linux box (and work on windows wamp , suprised when moving on production).

linux windows virtual-machine vagrant virtualbox

No comments:

Post a Comment