No way to make Laravel/Homestead work –show in browser - php

Having spent 1.5 days trying to fix this I thought that I might as well come before you for an answer.
Newbie in Laravel, I've been trying to set up the dev environment in my laptop (MacOS, High Sierra 10.13.6).
I've installed Virtual Box, Vagrant (v 2.2.9), Composer & Homestead
This is what my Homestead.yaml looks like:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Laravel
to: /home/vagrant/Laravel
sites:
- map: test.app
to: /home/vagrant/Code/Laravel/public
databases:
- test
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
I've also configured my /etc/hosts file as follows:
1922.168.10.10 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.10.10 test.app
I've been experimenting with the paths in the folders and sites, also following different suggestions from forums but, if anything, I get from my browser either:
No input file specified
or
ERR_CONNECTION_REFUSED
Some few additional info:
The official Laravel documentation says that you have to map folders to each and every project, but the tutorials out there say that you only have to map it to the folder that will contain all project folders.
I've tried to match the IPs in Homestead.yaml and /etc/hosts but at least when they were different (192.168.10.10 and 127.0.0.1 respectively I got the No input file specified, which -I think- it means that at least the browser managed to connect to the server, but didn't find the right file.
As for Vagrant, I can vagrant up, vagrant halt, and vagrant destroy without further issues when I cd in my Homestead folder. I can also vagrant ssh without further issues.
The file receiver of the installation of Laravelcomposer global require laravel/installer is named Laravel and located in /Code and same level as Homestead.
All help will be dearly appreciated. Please ask anything else I may have missed.
Thanks so much in advance. I hope this helps future Laravel newbies as well.
Resources used:
Mainly this tutorials + this tutorial + this post + a few hours of Googling around.

Related

"No input file specified." when running Laravel Homestead

I've installed Laravel Homestead and edited my host file but when I visit the specified URL in my browser I get the message "No input file specified." after running "vagrant up" in terminal. My initial guess is something's incorrect in the Homestead.yaml file but I can't see what.
I'm running Mac OS and my VM is a VirtualBox one. All my websites are in a folder called "Sites" which is a direct child of the OS user, so Username/Sites. The path of my Homestead folder is also in there like this: _Username/Sites/_homestead".
In the Homestead.yaml file I set my 'folder' to map: ~/Sites - that should mean when I visit the specified URL in the browser I get a list of folders (all of my websites), right? Or at least that was the result I'm expecting.
If I type ~Sites/ in my browser address bar I do see a list of folders so the location is correct. It redirects to file:///Users/USERNAME/Sites/
Before I run vagrant up 'username.dev' will not work when typed in the address bar, afterwards it does. So I assume that's all correct as it does pick it up.
This is the contents of my Homestead.yaml file for reference:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Sites
to: /home/vagrant/Code
sites:
- map: username.dev
to: /home/vagrant/Code/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
Can anyone see what's wrong or advise on what else is could be?
Apparently you have to specify a specific folder, but if you want to switch quickly between your different projects you can map to multiple directories in the homestead.yaml file like that:
sites:
- map: firstProject.dev
to: /home/vagrant/Code/firstProject/public
- map: secondProject.dev
to: /home/vagrant/Code/secondeProject/public
You executed the command vagrant up --provision and still the same output?
I found similar questions which might help you here :
Using Laravel Homestead: 'no input file specified' and After installing Homestead I get "No input file specified" in the browser. How can I access my laravel project
if the folder Username/Sites contains different site folders, try to map the URL to: /home/vagrant/Code/yourSiteFolderName/public
and run vagrant reload --provision or vagrant up --provision to reload the configuration
For me after hours of searching I realized I had a capitalization error :(
- map: C:/Users/jason/Code/blog
to: /home/vagrant/Code/blog
sites:
- map: blog.test
to: /home/vagrant/***code***/blog/public
Code was code in the sites to: section.
So just an caution to everyone to check for the simplest errors first ;)

vagrant homestead can't access host(laravel 5.2)

When I goto my host ao.dev:8000 or ao.dev, "this site can't be reached,ao.dev refused to connect" is displayed.
My yaml file:
also i've my view file:
i've checked:
I've run vagrant up command by going to Homestead directory .
Also see: https://stackoverflow.com/questions/38801375/vagrant-up-not-forwarding-all-portshomesteadlaravel-5-2windows-10
Actually I was using WAMP before installing homestead.
So I uninstalled both i.e. wamp and homestead setup including vagrant and virtual box.
Then I installed homestead setup again and it worked.
I dont know the logic behind but maybe wamp and homestead were conflicting.
It worked so I posted the answer.
What I needed to do to get my local Laravel up and running:
use 127.0.0.1 rather than 192.168.10.10 in my hosts file
make sure the .env file had the correct hostname listed as the APP_URL
make sure to use the :8000 port to access the site
Additionally:
if you're adding multiple sites, make sure to run vagrant provision after adding each site to your Homestead.yaml
not sure if it makes a difference, but you might want to put a space after the colon for the map command, i.e. map: ao.dev
I did not need to add hostname or name elements to Homestead.yaml
Here is an example Homestead.yaml file from one of my own projects:
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
hostname: vm
name: vm
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: "."
to: "/home/vagrant/example"
sites:
- map: example.dev
to: "/home/vagrant/example/public"
databases:
- example
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
Notice how my paths are double-quoted (to: "/home/vagrant/example")? In your code above, these paths are not double-quoted as they should be.
I also recommend after you fix your configuration that you completely destroy and re-create your VM by running:
vagrant destroy -f && vagrant up
In your Laravel project root directory.
Your Vagrant VM machine is up but you can't reach to the machine.
Can you paste your hosts file on your host machine?
Can you paste the output of a "nmap 192.168.10.10" from your host machine?
Can you paste "ls /etc/nginx/sites-enabled/ -la" on your Vagrant VM machine?
I had the same problem, I installed and run fiddler and it was enough to solve it.

Vagrant "No input file specified."

I am a python developer and my company wanted to do a project in PHP -laravel. Also he wanted me to start with Vagrant. So I came across this simple tutorial and tried to start with it. But still I'm getting error No input file specified.
I have been searching since whole day today for this issue, I have came across many posts which includes same query. I tried almost all the solutions from laravel.io and some stack overflow queries But did not got the exact solution.
Directory Structure:
Git Cloned Homestead - /home/laxmikant/Work/PHPWORK/Homestead
Mapped location - /home/laxmikant/Work/PHPWORK/codebase (totally empty directory)
Folders mapped to : /home/vagrant/codebase (Contains Laravel project)
Here is my Homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Work/PHPWORK/codebase #-- The path on my local machine
to: /home/vagrant/codebase #-- The path from the vagrant box
sites:
- map: homestead.app
to: /home/vagrant/codebase/Laravel/public #-- The path from the vagrant box which is mapped with folders
databases:
- homestead
variables:
- key: APP_ENV
value: local
Also I am assuming that,By Vagrant ssh when the project is created using :
composer create-project laravel/laravel Laravel --prefer-dist
It should also get synced with codebase directory of vagrant box
So the queries are:
Is this assumption correct? if so why map and to are not getting synced? and
What is the reason that I am getting the error "No input file specified.?
The assumption is correct whatever is in /home/vagrant/codebase will also end up in your ~/Work/PHPWORK/codebase.
After installing laravel via composer if the "no input file" error persists you probably need to reload configuration via running
vagrant provision
You should probably also add a homestead.app entry on your hosts file.
Thanks for your help.
It worked well with the following solutions:
nginx configured manually for my homestead.app
and changed, Sync locations in Vagrantfile

Does laravel/homestead box comes with default website setup?

I am trying to figure out if there is something wrong in my homestead setup
I am following the official direction. In the very end of the direction the tutorial said that accessing http://homestead.app is possible. However when I run the address in my chrome I get the No input file specified. message
I am not sure if this is the default page, so I checked my directory using
homestead ssh
and found out that
- map: /Users/Projects
to: /home/vagrant/Projects
both directory doesn't have any files inside, I am not sure if this is the default behavior, but according to this tutorial there should be a list of file in the folder
app artisan bootsrap composer.json composer.lock ....
I don't remember if homestead comes with a default website, but your homestead.yaml ( you can use homestead edit to open it )file should look like this:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders: //This is where vagrant will look for your projects
- map: ~/Code //This is your host folder
to: /home/vagrant/Code //This is your homestead folder
sites: //These are the urls that nginx will serve
- map: homestead.app
to: /home/vagrant/Code/homestead/public
- map: site2.app
to: /home/vagrant/Code/site2/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
Usually, homestead comes with a Code folder where you can find the laravel project (if there is one by default).
Also, remeber to add the urls to your hosts files.

Homestead "No input file specified" laravel 5

Been trying this for days! I am aware there are other Qs about this, which I have checked over an over. I have one site working and the other not.
I'm using Homestead with Laravel 5 and OSX 10.10.3
I have 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: ~/Sites/LaraCode
to: /home/vagrant/LaraCode
sites:
- map: myapp.app
to: /home/vagrant/LaraCode/myapp/public
- map: newapp.dev
to: /home/vagrant/LaraCode/newapp/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
Both are Laravel 5 apps in these folders:
/Users/USERNAME/Sites/LaraCode/myapp
/Users/USERNAME/Sites/LaraCode/newapp
myapp.app works fine but newapp.dev gives an error:
No input file specified
in the browser.
I have chmod777 the storage folder. There is an index.php in the public folder. I vagrant provision after changes.
Homestead seems to have been a horrible waste of time.
For me homestead destroy and another homestead up worked. Also I guess you added the new url to you hosts file, correct?
Although I agree that the docs for homestead are a little lacking.
Ok,I finally found an answer for this. I believe I had two homesteads set up, so I had to remove a homestead from the VM
I also had to do update my bash_profile so I could use the homestead commands.
Afterwards, in the homestead folder I ran:
homestead provision
To ensure the yaml file was up-to-date.
All is good now. Both sites are running. Server set-ups are always a nightmare for the less computer techie developers. Where I was caught out was the lack of clear folder guidance on where to execute command lines, hence the conflicting homesteads.

Categories