I'm trying to install Laravel Homestead in order to be able to test my Laravel projects locally.
I'm following this tutorial: http://laravel.com/docs/4.2/homestead
In the "Installing Homestead" part I followed the second step "Manually Via Git (No Local PHP)",I don't have any PHP installed locally and can't use Composer. (Wasn't PHP supposed to be installed as part of Homestead?)
I got to this part:
Once you have installed the Homestead CLI tool, run the bash init.sh command to create the Homestead.yaml configuration file:
bash init.sh
In command prompt I tried to enter the following command:
bash init.sh
I got the following error:
'bash' is not recognized as an internal or external command, operable program or batch file.
Then I tried to enter the same command in Git Bash, and I got the following error:
bash: init.sh: No such file or directory
When I tried to enter in Git Bash simply
init.sh
I got the following error:
sh.exe": init.sh: command not found
I ran into this problem well. You need to hop into your terminal (I am on Mac.)
Type into your console: cd ~/Homestead
and to make sure you are in your newly generated Homestead folder (you can always click Finder > your home directory > Homestead to confirm it's where it should be),
then while in terminal simply type ls -- if it lists all of the files like Vagrantfile, composer.lock and bash init.sh, you should be in.
Once you know you are in the correct Homestead folder, it is now at that point in which you run bash init.sh
After doing this it now says Homestead initialized!
.sh is a unix/linux script executable, that isn't recognized on Windows. There's a init.bat included in the package, but it isn't referenced in the tutorial.
Just run init.bat from the command line. It will copy the files to:
%HOMEDRIVE%%HOMEPATH%\.homestead
You need install Git Bash, and then run commands into Git Bash.
Try init.bat that worked for me
If the init.bat refused to work
Go to the Homestead folder.
C:/Users/Computer Name/Homestead
You will see init.bat: double click to run it.
Problem solved.
I found the answer you may be looking for. I was having the same problems with this. Just make sure at the end of bash init.sh you put a ;
So in the git bash cmd you will have this line
$ bash init.sh;
Just do it using sudo.
$sudo bash init.sh
Related
I create laravel project with PhpStorm. I'm using "Git Bash Here " as terminal.
C:\Users\kadir\www\basit-laravel>php artisan make:controller TestController
'php' is not recognized as an internal or external command,
operable program or batch file.
When I try to use the contents of terminal in PhpStorm, I get this error:
By the way I use vagrant and homestead.
You have two options.
Install your php locally (not recomended, because you will run in another problems with vagrant)
Access your vagrant instance (maybe vagrant ssh in you project folder) and run the php artisan commands
There is something like this as a git bash alternative:
https://cmder.net/
You must show the terminal called git bash or cmder in php storm
I was following these instructions to install homestead on my Mac
http://pastebin.com/48PHSNC2
Homestead installed properly, but when it initialized, it didn't create a Homestead.yaml file. I have no idea how to reinitialize homestead or fix this. Reading through the installation guide Laravel gives you, it suggests using $ bash init.sh to create the .yaml file... unfortunately, this apparently doesn't exist for me either.
I used the composer command to install the CLI:
composer global require "laravel/homestead=~2.0"
Any ideas? I'm stumped...
I ran into a similar issue using Homestead 2.X (I dont care for Homestead 3 ATM).
basically do the following:
find the bash_init.sh file by running sudo find / -name init.sh
cd into the directory it's in, mine was in /Users/me/.composer/vendor/laravel/homestead/init.sh
make it executable, by running chmod +x init.sh
run ./init.sh
...
profit!
You can generate manually by clone git clone https://github.com/laravel/homestead.git Homestead. This will generate homestead.yaml file. Open and edit and change the parameters to fit your system configuration. For further reading
https://dev.to/ko31/installing-laravel-homestead-on-macos-5910
I'm running php composer.phar install from git bash CLI and it shows sh:php: Command not found.
Though I have set environment variable path to my wamp/bin/php/php5.4.16/
You are required to put the directory that has php.exe in your WAMP installation into environment variable PATH. It is generally like C:\wamp\bin\php.
Where \php\ is the directory containing php.exe.
Set php env. variable as mentioned here. (you can test it easily using this command: php -r "echo 1;" or php -v)
restart git shell
if composer.phar does not exists, run this (more info):
php -r "readfile('https://getcomposer.org/installer');" | php
run php composer.phar install finally
Run php without git shell:
Locate C:\wamp\bin\php
Hold SHIFT and click with right mousebutton on folder phpX.Y.ZZ
Select Open command prompt window here
run any php command like php parameters
Whether you are using gitbash or cmd you should run it as an administrator. Navigate to your project then type the command "composer install" it will work. Mine worked just fine.
I'm getting an error saying:
failed to clone https://github.com/php-fig/log.git, git was not found, check that it is installed and in your PATH env.
'git' is not recognized as and internal or external command, operable program or batch file
when I try and run composer create-project laravel/laravel learning-laravel.
I installed the git GUI which also comes with a command line shell, but I don't know why its not recognising the command (I'm issuing the create-project command in the normal windows command line prompt).
I also tried running the command from the git shell, which worked, but when I tried php artisan serve it gave me an error saying CLI has stopped working.
Does anyone know how to fix the git error? I'd rather use the windows command shell instead of the git one as it can then go into my wamp/www file
You need to add the directory you installed git to to your PATH environment variable.
Right click on Computer.
Click Advanced System Settings
Click Environment Variables inside the Advanced Menu
Under System Variables, scroll to PATH
Add ;"C:\path\to\git\bin";"C:\path\to\git\cmd"
Test the git command in the command prompt to see if it worked. Git is usually located in Program Files or Program Files(x86).
There is an easier (but temporal) way to add a path variable in Windows.
Paste this in your command prompt:
SET PATH=%PATH%;C:\Program Files\Git\bin
This will work for the rest of the command prompt session. Don't forget installing Git before this.
You'll need to add git to your system PATH if you want to use it in regular command prompt.
Here's a guide on modifying your system path in Windows:
http://www.computerhope.com/issues/ch000549.htm
you need to uninstall git and reinstall ( or update ) in the options you need to change from git bash only to allow git to be added to command line as well, also since it then adds it to your path you may or may not need to restart your computer
I was having some issues using git on Windows. I found this information only and it worked for me.
http://ccn.ucla.edu/wiki/index.php/Setting_Up_and_Using_Git#Windows
I am currently working with symfony2 and I want to launch to download the libraries I need. I know the command in linux is "$ ./composer.phar update --dev" however when I run this in windows it prompts whether I should open the file with the windows explorer or not. I currently have composer.phar installed on windows but I am having trouble launching it. How would I be able to update my symfony2 folder with the dependencies I need. Thank you.
In CMD:
php C:\ProgramData\ComposerSetup\bin\composer.phar self-update
The problem is that Windows don't know how to open .phar files. You need to execute them using php interpreter php composer.phar update and the php interpreter(php.exe) must be accessible on PATH.
You could use command php -v to check if your php is accessible from command line.
Go to C:\ProgramData\ComposerSetup\bin\composer.phar
In CMD write php composer.phar (update) or (self-update)
1: Open cmd
First go to your work directory like if you have wamp then c:/wamp/www.
Then enter composer if you can see list of composer command then its good.
Now type "composer self-update".
5: Next you can see the process.
This worked for me on my Centos server
sudo -u nginx php composer.phar update