I completed upgrades from laravel 5 to laravel 8.
But my php artisan serve is not working.
I mean when i type php artisan serve and type enter then we should get an output showing some localhost link.
But for me it is not doing that
C:\Users\kr php artisan serve
C:\Users\kr
go to the .env file and change localhost to 127.0.0.1
Related
when i run php artisan key:generate in cmd it's return
file_get_contents(/project/positiv/core/vendor/psy//.env): failed to open stream: No such file or directory
at
/project/positiv/core/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php:96
{
file_put_contents($this->laravel->environmentFilePath(), preg_replace(
$this->keyReplacementPattern(),
'APP_KEY='.$key,
file_get_contents($this->laravel->environmentFilePath())
));
}
I am trying to generate APP_KEY!!!
At first generate APP_KEY with the command php artisan key:generate --show. It will print contents on your terminal which you can copy and paste wherever you want. In this case APP_KEY=value on your .env file.
Generated Key format will be something like base64:xxxxxxxxxxxxxxxxxxxxxxx.
It seems that you are trying to run artisan command outside the project.
Make sure your terminal is targeting the exact project you want to trigger
Right now I'm using a single log file, but there is requirement to make it daily , but for the current date, the file name must be laravel.log
laravel-2020-08-30.log
laravel-2020-08-31.log
laravel-202-009-01.log -> the current date must be laravel.log
`
Is it possible to get the logs daily, but named like this?
laravel.log
While the older (up to a week) are named like this:
laravel-2020-08-30.log
You can try given solution for you problem.
Update your .env file.
LOG_CHANNEL=daily
then you can run following this command on your terminal inside project root directory.
php artisan config:clear && php artisan cache:clear && php artisan config:cache
Now you can check your storage folder inside logs directory with following name conversion.
For ex:
laravel-2020-09-01.log
I am running on Laravel 5.3.
Whenever I try to php artisan serve and type localhost:8000, It returns phpinfo. Now additional confusion has it when I cancel the serve then refresh it still shows the phpinfo
Is there any solution to this as to what have I messed up(I am using mac air)
Any help would be great!
Try another command to change the port of the localhost :
php -S localhost:1988 -t public
First check your :8000 port may be its busy .
netstat -anp tcp | grep 8000
You can kill it or try to load it using another port .
php artisan serve --port=8080
Faced a similar problem. Any use of php artisan returned phpinfo(). The reason was the incorrect code dd(phpinfo()) in my routes/web.php:
Route::any('/any', dd(phpinfo()));
I'm trying to use Heroku local but it's not working as can be seen below. command prompt says 'vendor' is not recognized as an internal or external command...
C:\Users\owner\Desktop\php-getting-started> heroku local
[OKAY] Loaded ENV .env File as KEY=VALUE Format
15:23:09 web.1 | 'vendor' is not recognized as an internal or external command,
15:23:09 web.1 | operable program or batch file.
[DONE] Killing all processes with signal null
15:23:09 web.1 Exited with exit code 1
When I tried the first time, I got message saying like
"No .env file found"
so I added .env file but I still cannot run locally.
Any idea why this is happening?
I've had the same issue today but managed to solve it by updating my Procfile from
web: vendor/bin/heroku-php-apache2 web/
to
web: vendor\bin\heroku-php-apache2 web\
Hopefully this solves your issue too.
This worked for me
create a file Procfile.windows in the same location where Procfile
file is.
add this command in Procfile.windows - web: php -S localhost:8000 -t web/
in terminal run heroku local -f Procfile.windows
visit http://localhost:8000/
I'm using Laravel 4.2 in remote server and I want to execute Laravel commands php artisan migrate but I don't know how.
You can ssh to the server and perform the command, you can add your servers public key to the remote server to do this without a password. I made a bash script with the following code which I can then execute manually via command line or from a program, lets say I call it myscript.sh with the following code
ssh root#127.0.0.1 << EOF
cd /var/www/app/;
php artisan migrate --force; // force prevents artisan from asking for a yes/no on production
exit;
EOF
now I can write 'sh myscript.sh' and it will run migrations on the remote server.
For the completeness of this article, you do this with Windows host using PS remote (enable first) then...
$Username = "{domain}\{domain account}"
$PasswordSS = ConvertTo-SecureString '{domain account password}' -AsPlainText -Force
$Cred = New-Object System.management.Automation.PSCredential $Username,$PasswordSS
Invoke-Command -ComputerName {server name} -ScriptBlock { cd d:\wwwroot\{website};php artisan migrate } -Credential $Cred
This will return the result to your local machine.
I use this in VSTS release deployments all the time.
The preferred way to do this:
ssh into your server (for example, username root & server ip 1.1.1.1: ssh root#1.1.1.1).
go to your project folder (for example: cd /var/....)
run the command php artisan migrate.
Original post (not the best way):
You can setup a cronjob like this:
* * * * * /usr/bin/php /var/www/app/artisan schedule:run
This will run every minute and run the migration.
You can change this to everything you want.
If you want to open a url what while be excecuting the command.
Use this code:
Artisan::call('migrate');
Hope this works!
With Mac terminal
Step 1
sh root#your.ip.address e.g 181.6.41.221
Step 2
Enter your password
Step 3
cd /home/admin/web/yourdomain.com/public_html
Step 4 Laravel command:
"php artisan migrate"
Without the "quote"
Ask your host for your IP address and Password if not known by you.
The solution to this problem could be running once a php code (on the server) like this:
<?php
// installation.php file
echo exec('php /var/www/laravel-app/artisan migrate:install');
and than you need to visit installation.php in your browser.
After migration you should remove the installation file, so nobody can execute it again