Heroku bash cannot find php command - php

I wanted to publish Laravel App on Heroku today but Heroku bash couldn't find php command.
I update database details in config/database.php and next want to run migration but when i go to heroku run bash and php artisan migrate --app myappname I only see bash: php: command not found
I'm on Windows10.

Problem solved. In composer.json i had ~7.1.3 version of PHP, after change to "php": "~7.3.0" and git push heroku master it start work

Related

LARAVEL SAIL: OCI runtime exec failed: exec failed: unable to start container process: exec: "composer": executable file not found in $PATH: unknown

I am quite new to Laravel even though I have already created several mini projects.
Today I tried to create a new Laravel project with Sail in the way that the documentation indicates
curl -s https://laravel.build/blade-components | bash
The application is created correctly, I raise the container with ./vendor/bin/sail up, I compile the styles with sail npm run dev, I run the migrations and everything is correct in the browser (localhost).
The problem comes when trying to install JetStream with the composer command
sail composer require laravel/jetstream
The error is:
OCI runtime exec failed: exec failed: unable to start container
process: exec: "composer": executable file not found in $PATH: unknown
For some reason, it's like composer doesn't get installed to the project.
When I run sail, or sail npm (for example), it recognizes the commands and shows me the different actions available. I tried to run the composer command from sail's attach shell and it doesn't recognize it.
Executing task: docker exec -it 7b2cd6402559708130d9fdf7b8f8e8cbcd9ed47d524a77dd10cf2ee0068b5150 bash
root#7b2cd6402559:/var/www/html# composer
bash: composer: command not found
Then I opened previous Laravel projects to test if the sail composer command worked and the same thing happens (it didn't before), so it's not a project-specific thing.
I would greatly appreciate your help! P.S.: sorry for my English, greetings from Argentina!
I encountered the same problem.
My operating system is Windows11 and I created the laravel project in WSL
.
I found that if I service docker start in WSL, sail up -d will create or start containers in WSL and sail composer will show the same error.
But if I do not service docker start in WSL, sail up -d will create or start containers in Windows11 and everything is fine.
p.s. Sorry for my English, too.

How to setup Git Repo for Laravel Project to run after Cloning?

How do you to setup a Git Repo for a Laravel Project to run after cloning from a remote host like Gitlab, Guthub or Bitbucket? After cloning a Laravel repo to a local computer php artisan serve gives this error 'PHP Warning: require(D:\MyGitLab\laravel-project/vendor/autoload.php): failed to open stream: No such file or directory '. This means simply cloning does not work. What is the solution? I added all files and directories to origin repo.
Make a copy of .env.example to .env file.
Make database and link it from .env file.
Run composer update command
Run php artisan key:generate command
Install Bower, NPM or any other front end package if you are using.
Run php artisan migrate command.
Run php artisan serve command.
You are good to go!!!
run
php artisan key:generate
That should work.
You need to run
composer update
first to install package dependency and run
php artisan serve
and run
php artisan key:generate

How to Open Laravel project

I have created(installed composer create-project laravel/laravel basicwebsite) project named basicwebsite.
After that i run php artisan serve then it showed some URL then i got LARAVEL page in browser,fine.
(Accidentally, my system is shut down.)
To reopen the project ,in cmd prompt i just did as
php artisan serve
and the error occur is
I almost searched for solution in all websites(including stack) .All started with create project but not what to do after close and opened the project.
Thanks in advance.
Use php artisan config:clear command to clear cache. You should see
Configuration cache cleared
Use php artisan serve command to start the server.

cloning laravel project from github

I'm new to GitHub and I found this site very useful for a lot of us. I came upon storing my Laravel project here in GitHub, but there's a problem every time I will clone it to be able to go to production, when I'm about to clone it at first, it always shows this error.
Warning: require(C:\xampp\htdocs\tourismPortal\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\tourismPortal\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\tourismPortal\bootstrap/../vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\tourismPortal\bootstrap\autoload.php on line 17
I know this will be solved by using composer update on it, but is there any way to prevent this error so that every time I clone it, I will go to production without encountering this error? Thanks, by the way, I'm using tortoisegit to clone, pull and push.
Clone your project
Go to the folder application using cd command on your cmd or terminal
Run composer install on your cmd or terminal
Copy .env.example file to .env on the root folder. You can type copy .env.example .env if using command prompt Windows or cp .env.example .env if using terminal, Ubuntu
Open your .env file and change the database name (DB_DATABASE) to whatever you have, username (DB_USERNAME) and password (DB_PASSWORD) field correspond to your configuration.
Run php artisan key:generate
Run php artisan migrate
Run php artisan serve
Go to http://localhost:8000/
Yes you can, but that is not recommended at all.
You can delete everything in .gitignore file and push them from a working project. Then it will work perfectly where you git clone them.
But there are so many drawbacks in this way.
I recommend you not to do that.
Run `git clone 'link projer github'
Run composer install
Run cp .env.example .env or copy .env.example .env
Run php artisan key:generate
Run php artisan migrate
Run php artisan db:seed
Run php artisan serve
Go to link localhost:8000 OR 127.0.0.1:8000
You guys missed a step here, after this command
php artisan key:generate
Don't forget to run npm install && npm run dev
If you have any front-end environment setup, this command will clear all the dependencies...
Thanks for everyone's great help I also run the command to make the project work.
composer update
Run the following commands:
git clone --single-branch --branch [TAG_VERSION] https://github.com/laravel/laravel.git [CUSTOM_PROJECT_NAME]
composer install

Running laravel migration on heroku server

I have a production server, and i have deployed the code into the server, but when i try to migrate the databse with this command :
heroku run php artisan
This what i have returned
Running php artisan on [app-name] ... up, run.3899
bash: php: command not found
And the BUILDPACK_URL in the Config Vars set to
https://github.com/heroku/heroku-buildpack-php
any help please :) ?

Categories