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
Related
Is there a way to run terminal commands simultaneously
Like
php artisan serve
And
npm run dev (for laravel vite)
Run it in a comment or terminal with a shortcut
Yes. There is a creative way
You should define a variable in your command line
İf you're using linux run this command:
export part="php $PWD/artisan serve"
Note:part is variable name. Name it whatever you want (part stands for php artisan)
Note:by running this command the variable will accessible just in that CMD window. That means this way is a temporary way and if you want to access it all the time you need to add this command to your .bash or .profile file
I am trying to run a symfony command via the command line. On writing the below command
bin/console doctrine:database:create
it outputs an error
'bin' is not recognized as an internal or external command,
operable program or batch file.
php is installed on my machine and configured in environment variables but I am getting that error. Please what could be wrong?
This is a Linux like command. Obviously you are coming from Windows system:
php bin\console doctrine:database:create
Pro tip: you can shortcut commands as long as the shortcut is unique:
php bin\console doc:dat:cr
Make sure you cd to the app's directory before running the command too.
I'm using Laravel 5.3.0 and it's running on a local server with Manjaro. I access the project folder trough ssh and I'm also using artisan trough SSH.
Everything runs fine, I run the server trough terminal:
php artisan serve --host 192.168.0.10 --port 80
And can acess the project trough browser.
But when I run this command:
php artisan make:controller ContatoController
or
artisan make:controller ContatoController
Nothing happens, it get's stuck, no message error after minutes. No controller is created.
Does anyone know how to solve this?
Here's what happened:
I was running artisan server and after that (on the same terminal) I was running the make:controller command.
The solution was:
1- Open linux terminal, run artisan server;
2- Open another terminal (or split window if you'r using Terminator) and use all commands you want.
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
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.