I installed Laravel through composer using PHP 7.3.25 through xampp v3.2.4. I first noticed the problem: cli stopped working, during
php artisan serve
I scoured SO and the internet for possible fixes. Going through these commands fixed this problem for me (or so I thought):
composer update --no-scripts
php artisan clear-compiled
composer dump-autoload
But every time I turn on the PC, I get the same error and have to follow these steps to make it work. Antivirus did not have anything to do with it (I checked). Is there any way to fix this without having to completely reinstall everything?
Its ist important to understant few points related to following queue:restart command.
The queue workers' age confirmed that they restarting in response to that.
php artisan queue:restart
Ref: https://laravel.com/docs/8.x/queues#queue-workers-and-deployment
I am using laravel 5.6 and have the problem, when I use the command "php artisan vendor:publish" in the console, I get the following error:
[ERROR] Use of undefined constant STDIN - assumed 'STDIN'
Which provider or tag's files would you like to publish?
[0] Publish files from all providers and tags listed below
[1] Provider: Intervention\Image\ImageServiceProviderLaravel5
The problem is, that these messages appear infinite, until I close the console or after a long time it kills the process.
I looked for this issue on google, but only found the problem with stdin and the difference is, that the people who had that problem, didn't call artisan in the command line interface, but directly in a php script.
The same problem appears when I use "php artisan migrate"
I was getting the issue mentioned above while running artisan command to seed the db tables: Artisan::call('db:seed', [...]) while in production.
Adding the --force flag fixed my issue
Artisan::call('db:seed', [
'--force' => true
])
Make sure you use --force flag if you are in production.
I have found a solution for the problem:
I had to add the following line to the artisan file (in the laravel directory).
define('STDIN',fopen("php://stdin","r"));
Now it works.
It's still strange, because normally artisan should work out-of-the-box, without the need to change anything.
Add
if(! defined('STDIN')) define('STDIN', fopen("php://stdin","r"));
to your index.php file. I tried adding this to artisan file but didn't work but placing it in index.php did the trick.
My PHP version is v. 7.4 on Ubuntu 18.04
This problem is caused by application environment.
Change application env to local or add --force parameter after artisan command.
One thing to check is to ensure you are running the correct version of PHP for the version of Laravel.
php -v will show the php version
I was surprised to see that for me, the CLI version of PHP (which is what artisan uses) was really old.
I didn't realize my shared host had many different versions of PHP installed.
I was able to run artisan commands by using the command corresponding to the PHP version I needed to use: php7.1 artisan migrate
I'm looking to globally prepend a directory to my $PATH variable in Centos6. Currently it is as follows:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
I would like it to become:
/opt/plesk/php/7.0/bin/php/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
I've already made a modification which changes the directory correctly for when I run "which php" but that doesn't seem to satisfy scripts that I execute which call php.
EDIT:
Why do I need to do this?
I am running a script called Composer (found here: https://getcomposer.org/), it is used for PHP development and then runs a command automatically which is "php artisan clear-compiled" (used in Laravel 5 projects).
When running the command "php artisan clear-compiled" myself I get no errors because it uses php7 which is configured for the root account. When the script runs it it errors because it is trying to execute using PHP 5.4 which isn't supported by artisan.
I have created some Command files into my Laravel Application. Laravel version is 5.2. I set command like: get:email in the Command file. Also call the Command file into Kernel.php. After that I can see the artisan command list by typing the command php artisan list. as like as below:
//output
get:email
And I changed the command title get:email to get-bq:email. When I run the command php artisan get-bq:email -- its working nicely. Also I can see the list by typing the command php artisan list::
//output
get-bq:email
Issue / Problem: Both commands are working. But I won't to work with both of them. I have done the following things:
modified command file as well as command
run composer dump-autoload -o
run composer update
remove vendor and storage folder then run composer update again.
Still the old command is working into my system.
What I want: How May I remove my old commands from my Laravel(5.2) application?
Run these commands:
php artisan cache:clear
php artisan config:clear
These commands will clear app cache and config cache and recreate it.
I've had the same problem recently.
Repoeatedly tried
php artisan cache:clear
php artisan config:clear
and the cached Kernal command wouldn't clear.
In desperation i killed the queue worker terminal and restarted the queue with the command
php artisan queue:work
The issue stopped.
I looked at some of the similar questions and they have a similar problem except their php -v version is the one that is higher than the phpinfo() reported version. For when I call phpinfo() from php file it shows 5.5.25 which is correct. In the terminal through ssh I run php -v and it gives me 5.4.43. I'm using GoDaddy hosting and on cPanel I have it set to 5.5. I'm using Composer and Laravel. When I create a new Laravel project it gives me this error:
[~/public_html]$ laravel new blog
Crafting application...
> php -r "copy('.env.example', '.env');"
> php artisan clear-compiled
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
run-script [--dev] [--no-dev] [-l|--list] [script] [args1] ... [argsN]
Application ready! Build something amazing.
You need to use a different path to get to the right version of the command line PHP.
Use
which -a php
To get the paths to the available versions of PHP, then use the full pathname.
For example
/usr/bin/php5