Laravel Homestead - No input file specified? - laravel

I am trying to install a Homestead VM for Laravel development on Debian Linux 8 with Vagrant 1.8.4 and VirtualBox 5.0.24 r108355.
Following the official documentation, I have installed Homestead and configured it in Homestead.yaml in the following way:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code/dev.todoparrot.com
to: /home/vagrant/Code
sites:
- map: dev.todoparrot.com
to: /home/vagrant/Code/dev.todoparrot.com/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
To test it with a sample file, I have created an index.php in /home/user/Code/dev.todoparrot.com/public/ on my local machine that echos a string:
<?php echo "Hello from Homestead!"; ?>
I have also added dev.todoparrot.com to /etc/hosts:
127.0.0.1 localhost
127.0.1.1 debian
192.168.10.10 dev.todoparrot.com
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Within the Homestead folder of my local machine, the VM starts both via vagrant up and vagrant up --provision, but when I visit the domain http://dev.todoparrot.com/ in the browser, I get the following error:
No input file specified.
Any idea what could be wrong?

No input file specified
It says that you don't have any file in
/home/vagrant/Code/dev.todoparrot.com/public
For now, your Vagrant path is
/home/vagrant/Code/dev.todoparrot.com/
And you looking for dev.todoparrot.com/public in dev.todoparrot.com
That's your issue
You need change
folders:
- map: ~/Code/dev.todoparrot.com
to: /home/vagrant/Code
to:
folders:
- map: ~/Code
to: /home/vagrant/Code
It will emulate all folders in Code to /home/vagrant/Code/
Run vagrant up --provision after every update of Homestead.yaml
And in the future, you need to change/add only
sites:
- map: project-name.app
to: /home/vagrant/Code/ProjectName/public
Use vagrant ssh to check your current folders structure inside Code

If you already tried
vagrant up --provision
and still you getting 'No input file specified' error, try to run
vagrant reload --provision
reload vagrant box works for me.

Related

Laravel project wont serve to given ip via Homestead

I am having trouble setting up my laravel project on my mac. I have (As far as I can tell) set up the homestead.yaml config correctly within my Homestead directory:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Documents/GitHub/project-darwin
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/public
php: "7.2"
databases:
- homestead
After I have used vagrant up, on using vagrant ssh I can see my project inside of vagrant/code/project-darwin.
My hosts file is as follows:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.10.10 homestead.test
Which looks correct as is no different to what I normally do when running other laravel projects on virtualbox, however on going to my url, I get a 500 error and the same applies if I go directly to the ip (198.168.10.10).
A further thing I find suspicious is the following. When I use vagrant up, this is part of what shows in my terminal:
homestead-7: Waiting for machine to boot. This may take a few minutes...
homestead-7: SSH address: 127.0.0.1:2222
homestead-7: SSH username: vagrant
Should this ip be the same as the ip I supplied? Anyway, I have run out of ideas as to how to go about fixing this, any suggestions?
So it turns out my mac had auto selected . hyperv as my provider when I ran vagrant box add laravel/homestead, oh well..
In your Homestead.yaml config file you are doing the following:
Making a shared folder mapping project-darwin to /home/vagrant/code
folders:
- map: ~/Documents/GitHub/project-darwin
to: /home/vagrant/code
But under sites you are mapping the folder /home/vagrant/code/public to homestead.test, meaning when you are requesting homestead.test or the IP of your Vagrant Box, you are not calling upon project-darwin but rather the "empty" public folder.
sites:
- map: homestead.test
to: /home/vagrant/code/public
I would recommend either moving your code to the public folder or mapping sites to your desired destination.
Hope this helps :)

The web.app page isn’t working

When i try to open web.app it doesnt work. But vagrant up running successfully. Hier is my Homestead.yarn file
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/www/
to: /home/vagrant/www
sites:
- map: web.app
to: /home/vagrant/www/web
databases:
- homestead
I'm using Mac OS.
laravel box : laravel/homestead (virtualbox, 1.1.0)
in hosts 127.0.0.1 web.app (192.168.10.10 and 127.0.0.1 both doesn't work)
vagrant and homestead are up to date. Any idea?
web.app:8000 doesn't work else
First on your homestead.yaml file, make the following changes
folders:
- map: ~/www/web
to: /home/vagrant/www/web
sites:
- map: web.app
to: /home/vagrant/www/web/public
Then go to your Homestead folder and do
vagrant reload --provision
After reloading do
vagrant up
Then edit the /etc/hosts file and add the following line
192.168.10.10 web.app
Now you should get laravel homepage when you hit web.app on your browser
I don't know why but my hosts file is ignored. Therefore i used just 192.168.10.10 instead web.app after 10 hour i fixed the problem. just deleted hosts file and created it again.

Homestead setup does not work

I installed homestead and laravel 5.3
Now I want to setup my homepage and access it locally. Therefore I created this YAML file:
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Documents/Development/Source/MFServer
to: /home/vagrant/Development/Source/MFServer
sites:
- map: loc.medifaktor
to: /home/vagrant/Development/Source/MFServer/public
databases:
- homestead
and the hosts file:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.10.10 loc.medifaktor
But when I access loc.medifaktor I get the error:
This site can’t be reached loc.medifaktor’s server DNS address could
not be found.
The folders: attribute is meant as a root folder for all your projects. Change it to:
- map: ~/Documents/Development/Source
to: /home/vagrant/Development/Source
Make sure your MFServer project is installed in the Source folder, so basically like your site mapping now says.
Then reload & provision homestead with vagrant reload --provision or homestead reload --provision if you've defined an alias.
If you now ssh into homestead, your project's source code should be available in /Development/Source/[project]

Laravel homestead not mapping my code folder

I am trying to get homestead to work after following the instructions here
I have Virtualbox 5.0.6 and Vagrant 1.7.4 on windows 8. The machine boots up fine(ish) the only problem is that my mapped folder is not present on the vm, meaning when I vagrant ssh, the directory /home/vagrant/ is empty, there is no Code directory inside of it. This is a screenshot of the machine booting(it should keep going and saying mapping the folders and stuff):
And this is the content of my Homestead.yaml file
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:\Users\Khalid\.ssh\id_rsa.pub
keys:
- C:\Users\Khalid\.ssh\id_rsa
folders:
- map: D:\work
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
Could someone please help, Thanks
EDIT: The full output of vagrant up --debug can be found here
sstarlight was on the right track. It's a path name issue. I'm on windows 8 with homestead too and you need to use the forward slashes even in your windows paths.
The below should do the trick!
authorize: C:/Users/Khalid/.ssh/id_rsa.pub
keys:
- C:/Users/Khalid/.ssh/id_rsa
folders:
- map: D:/work
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
I would add to this that you should run the provisioning as per the other answer after you make the change by bringing your homestead up with the --provision flag set.
Make sure and re-verify that the path for the keys and authorize are correct and run vagrant up --provision to re-provision the homestead setup again
Try change
D:\work to D:/work/

Homestead multiple sites not working

I'm a newbie on laravel, and running homestead I had one site before added another one did not work. I destroyed homestead and started once again and added two sites in Sites section in homestead.yaml file the bluprint of my homestead.yaml file is below
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/laravel
to: /home/vagrant/laravel
sites:
- map: project1.dev
to: /home/vagrant/laravel/project1/public
- map: project2.dev
to: /home/vagrant/laravel/project2/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 93000
# to: 9300
# - send: 7777
# to: 777
# protocol: udp
I added those two sites in my /etc/hosts file as well blueprint is below
#laravel maps
192.168.10.10 project1.dev
192.168.10.10 project2.dev
but when i run project1.dev or project2.dev they both show me the content of project1.dev files
Any Idea?
You can't use tabs on the file, use only spaces to indentation and this will solve the problem.
Now, only run
vagrant reload --provision
To reload the configuration file.
Note: If you use vagrant destroy and vagrant up, you lose everything on your VM.
I think I needed to the vagrant provision command to restart the server and register the changes that I have made
so once you finished with homestead.yaml and /etc/hosts file run this
vagrant provision
Like how here says, you can install Homestead directly into your project, require it using this composer require laravel/homestead --dev at root directory of each project you have. Now by make command you can generate Vagrantfile and Homestead.yaml file into your project's root directory.
Mac/Linux:
php vendor/bin/homestead make
Windows:
vendor\bin\homestead make
On each project root you will have a Homestead.yaml file to edit:
Project-A
ip: "192.168.10.10"
...
folders:
- map: "~/Code/projecta"
to: "/home/vagrant/projecta"
sites:
- map: project.a
to: "/home/vagrant/projecta/public"
Project-B
ip: "192.168.10.11"
...
folders:
- map: "~/Code/projectb"
to: "/home/vagrant/projectb"
sites:
- map: project.b
to: "/home/vagrant/projectb/public"
Add this to /etc/hosts:
192.168.10.10 project.a
192.168.10.11 project.b
Then you have to cd to each project's root and vagrant up.
Now if you vagrant ssh from each project, you will have that project in your VM environment.
Of course there is a Homestead.yaml file inside ~/.homestead, but vagrant goes for the .yaml file that is located inside project root first. In my case, the ~/.homestead/Homestead.yaml file is ignored.

Resources