126
votes

I am new to using Laravel, and Homestead, and would appreciate any help or a point in the right direction. I have successfully been able to get to the "You have arrived" screen when I run "php artisan serve" but when I try to do the same thing via Vagrant, I get "no input file specified". My Homestead.yaml file looks like this:

authorize: /Users/me/.ssh/id_rsa.pub

keys:
    - /Users/me/.ssh/id_rsa

folders:
    - map: /Users/me/code/exampleproject
      to: /home/vagrant/code/exampleproject

sites:
    - map: exampleproject.app
      to: /home/vagrant/code/exampleproject/public

variables:
    - key: APP_ENV
      value: local

On my computer I have the following directories:

/Users/me/code/Homestead
/Users/me/code/exampleproject //this is the directory created with composer

On my Vagrant Box I have for some reason two directories named "code" and "Code":

/home/vagrant/code/exampleproject 
/home/vagrant/Code

I have checked and I can see changes made to my computer exampleproject files are reflected in the vagrant box files.

Not really sure how to figure this out!! I would really appreciate any help possible :)

30

30 Answers

175
votes

Instead of reinstalling try

vagrant up --provision

or

homestead up --provision
44
votes

I had the same exact problem and found the solution through the use of larachat.

Here's how to fix it you need to have your homestead.yaml file settings correct. If you want to know how its done follow Jeffery Way tutorial on homestead 2.0 https://laracasts.com/lessons/say-hello-to-laravel-homestead-two.

Now to fix Input not specified issue you need to ssh into homestead box and type

serve domain.app /home/vagrant/Code/path/to/public/directory this will generate a serve script for nginx. You will need to do this everytime you switch projects.

He also discussed what I explained in this series https://laracasts.com/series/laravel-5-fundamentals/

29
votes

This is easy to fix, because you have changed the folder name to: exampleproject

So SSH to your vagrant:

ssh [email protected] -p 2222

Then change your nginx config:

sudo vi /etc/nginx/sites-enabled/homestead.app

Edit the correct URI to the root on line 3 to this with the new folder name:

root "/Users/MYUSERNAME/Code/exampleproject/public";

Restart Nginx

sudo service nginx reload

Reload the web browser, it should work now

27
votes

For me the following worked:

vagrant reload --provision

8
votes

Giving my response just in case if anybody struggling with this issue.

  1. You might need to verify that the server.root configuration in "/etc/ngnx/sites-available/domain" matching with your sites.to config in "Homestead.yaml".

  2. If its not matching then change it and restart the webserver with "sudo service nginx restart"

  3. And still things are not working then allow write permission for the "YOURSITE/app/storage" folder as "chmod -R 777 app/storage"

8
votes

I also had the same problem, I had assumed that Laravel is installed "out of the box" but it seems it isn't. I SSH'ed to the machine and ran these commands:

cd Code
sudo composer self-update #not necessary, but I did it anyways
composer create-project laravel/laravel Laravel --prefer-dist

And everything was running as usual.

5
votes

This issue occurred for me after editing the Homestead.yaml. I resolved this issue by

homestead destroy
homestead up
5
votes

I had the same issues

But forgot that the specs said the configuration file would be located at

~/.homestead/Homestead.yaml and was updating ~/Homestead/src/stubs/Homestead.yaml

So the FIX was to update the Homestead.yaml located here at

~/.homestead/Homestead.yaml

Before

sites: - map: homestead.app to: /home/vagrant/Laravel/public

After

sites: - map: homestead.app to: /home/vagrant/Code/mysitename/public

Then I ran
vagrant up --provision

Hope this works for anyone else.

3
votes

After I renamed some directories, I had to destroy and rerun vagrant. None of the solutions here worked.

This worked for me:

vagrant destroy
vagrant up
3
votes

Same issue for me.

Neither vagrant provision or homestead up --provision worked for me, but the below did - probably as homestead was already running when I modified the yml file

vagrant reload --provision

2
votes

Restart your homestead. Worked for me.

homestead destroy
homestead up
2
votes

I had the same issue while following the Laravel docs (https://laravel.com/docs/5.2/homestead)

My problem was very simple, I missed read this part in the docs:

Homestead.yaml file will be placed in the ~/.homestead hidden directory:

So I was updating the wrong Homestead.yaml file, since the file was moved when I ran the bash init.sh command.

I only realised this after a lot of searching, so hope this will help someone.

2
votes

I was just struggling with same situation. Following solved the issue:

If you have directory structure like this:

folders:
    - map: /Users/me/code/exampleproject
      to: /home/vagrant/code/exampleproject

Just create 'public' folder within exampleproject on your host machine.

2
votes

I am using Windows 10 and has the following Homestead configuration

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa
folders:
    - map: ~/code               #folder in local computer where codes are stored eg, c:\xampp\htdocs\project1
      to: /home/vagrant/code    #folder in the VM where the above code will be mapped

sites:
    - map: homestead.local          #fake name of the site (redirect this domain to the above IP ie 192.168.10.10 in hosts file ie, c:\windows\system32\etc\hosts)
      to: /home/vagrant/code/public #complete path to index.php file in the local computer to be utilized by homestead.local 
databases:
    - homestead

I PINGed the homestead.local domain and was getting results.

But when I typed http://homestead.local in the browser, I got 'no input file specified' error

I checked the code/public folder and there was no index file. I was sure the system was looking for the default file which was somehow missing.

Once I created an index file it started working fine.

Update:

Next time it happened after a change in the Homestead.yaml file, I ran vagrant reload --provision command and it worked.

It looks that running vagrant reload only will not provision the vagrant box. Read here

1
votes

Word of caution, linux is case sensitive. That is probably why you see a "Code" and a "code" directory.

What I would do is redo the vagrant setup again and if you want to keep it simple and matching what the Homestead box has as a default make your directory in your host machine "Code" with uppercase.

You could also in the "folders" section just map to your "Code" folder in your machine, in case you decide to add more sites to your Homestead setup later. That way under /home/vagrant/Code/ you will see all your site projects and you can ass more sites pointing to their "public" directories.

1
votes

This is likely because the nginx web server is not pointing to the right path.

There's two keys that you should look at: the map key under folders and the to key under sites. The folders key maps folders on your local machine to the vagrant VM. The sites key is used to create a virtual host on nginx with the value in to.

What you want to make sure is that to under sites points to the right path to public.

The problem was that I created my laravel project with composer create laravel/laravel. This created a folder in my current directory named laravel. Then without changing directories I installed the homestead helper with composer require laravel/homestead --dev.

After running php vendor/bin/homestead make and vagrant up my directory structure looked something like this:

$ cd laravel51
$ ls -a
.
..
.vagrant
laravel
composer.json
composer.lock
vendor
Homestead.yml
Vagrantfile 

My Homestead.yml looked like this:

folders:
    - map: "/Users/USER/Sites/sandbox/php/laravel51"
      to: "/home/vagrant/laravel51"

sites:
    - map: laravel51
      to: "/home/vagrant/laravel51/public"

If you look closely, the /Users/USER/Sites/sandbox/php/laravel51 path will be mounted onto the vagrant VM. This is the wrong directory because it should be pointing to the laravel project root where your app directory is. What happened here was that I was supposed to require the homestead helper while I was in the project root.

So now the question is what do I do? You've got two options: get rid of your current homestead VM and start over, but this time from the project root OR salvage what you have already.

If you want to salvage what you have, you'll have to move several files and a folder to your laravel project root.

These are the artifacts you'll need to move:

.vagrant
Homestead.yml
Vagrantfile

The composer.json won't be needed since you'll be requiring it later.

Move those files to your laravel project root and change your current working directory to there (cd laravel). At that point just update the map under folders and make sure that it's pointing to the project root. Also make sure that the to key under sites is the to key under folders with /public appended to it.

For example:

folders:
    - map: "/Users/USER/Sites/sandbox/php/laravel51/laravel"
      to: "/home/vagrant/laravel51"

sites:
    - map: laravel51
      to: "/home/vagrant/laravel51/public"

Now run composer require laravel/homestead --dev so that the homestead helper is required into your current project's composer.json file and installed.

Run vagrant reload --provision and you should be all set.

1
votes

This usually happens when you edit the Homestead.yaml file.

If like me you tried homestead up --provision and didn't worked! then try this (it works for me):

  • homestead destroy
  • homestead up
1
votes

Older versions of Homestead maps folders in ~/Code to say for example by default ~/Code/laravel/public. Notice the case capitalisations in ~/Code. These are case sensitive. New versions use lower case ~/code. Update these directories in your Homestead.yaml according to your actual directories.

TL;DR;

Update ~/Code to ~/code or vice versa depending on your actual directory names.

0
votes

In Laravel 5 I had to ssh into my homestead server and run these commands:

sudo chmod -R 777 storage
sudo chmod -R 777 bootstrap/cache
0
votes

Here's my solution:

It's a file path problem so below are my folders & sites paths. Also, I had to use "vagrant destroy" as provisioning didn't work.

enter image description here

0
votes

My problem was in the config file of the domain:

the public folder of my project was created in /home/vagrant/Code/demo/public

the config file of the domain (for me /etc/nginx/sites-available/demo.app) had configured: "/home/vagrant/Code/Laravel/public" instead of "/home/vagrant/Code/demo/public".

Now it is working perfect.

0
votes

I have had similar issues with Homestead and just provisioning the box worked for me. So you should try this:

vagrant provision

0
votes

vagrant provision related codes didn't work for me, after lost some time, I've restart the whole system. Now it works... -,-"

0
votes

I edited homestead.yaml and hosts according to this laracast tutorial and restarted homestead using vagrant suspend, vagrant halt, etc. /vagrant up; I tried to vagrant provision as well, but no file specified only went away after I restarted my computer (I'm on Windows 7 PC) after doing all of the above. It is certainly a time consuming and tricky error.

This is what my working homestead.yaml looks like for two laravel projects:

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
- ~/.ssh/id_rsa

folders:
    - map: D:\Projects
      to: /home/vagrant/Projects

sites:
    - map: projectone.app
      to: /home/vagrant/Projects/ProjectOne/public
    - map: projecttwo.app
      to: /home/vagrant/Projects/ProjectTwo/public

databases:
    - laraveldb

and here is my hosts file:

...
127.0.0.1       localhost
192.168.10.10   projectone.app
192.168.10.10   projecttwo.app

Note, there are two separate installations of laravel in D:\Projects\ProjectOne and D:\Projects\ProjectTwo

I then access the first project by typing projectone.app:8000 in the browser and projecttwo.app:8000 for the second project.

P.S. I tested this for Laravel 5.2 on Windows

0
votes

This happens because you need to configure your nginx server properly in order to serve you application. You can do this following this guide, starting in the topic Configure Nginx and the Web Root.

After properly configuring your symbolic link between your /etc/nginx/sites-available and /etc/nginx/sites-enabled you need to make sure your root variable is set to your application's folder path. Set your nginx root from

root /usr/share/nginx/html;

to

/home/vagrant/Projects/ProjectOne/public

Also, you have to place index.php before your html files so php is served before html. Change this

index index.html index.htm;

to this

index index.php index.html index.htm;

After finish your configuration restart your nginx server with

sudo service nginx restart

Your application should be served now.

0
votes

I had such problem. I reviewed Homestead.yaml file and all files and all of the settings were correct. My problem removed after the following steps.

1-If you are in vagrant@homestead:~$ command line, type exit command.

2- Now you must be inside Homestead folder. run this command

vagrant reload --provision

3- run vagrant ssh

Now if you type the related address in your browser it should show the Laravel page.

0
votes

Try restarting your computer

Had a working Homestead running locally, which at some point stopped and would get the "No input file specified" error. I couldn't trace it.

With a computer restart, the error disappeared.

0
votes

If you renamed the folder containing your Homestead project, you'll get this error. Visit your Homestead.yaml file and update any references to point to the renamed folder, then do vagrant up (etc.) again

0
votes

If your using a new version of larval 7 >= you can use from your homested directory vagrant provision

0
votes

This error only happens to me when I perform a new installation without creating the directories correctly, eg "correct": C:\Users\userxyz\Code\public.

Try removing the "public" directory, the error 'no input file specified' is displayed

Homestead.yaml

folders:
    - map: ~/Code
      to: /home/vagrant/Code
      #type: "nfs"

sites:
    - map: homestead.test
      to: /home/vagrant/Code/public