How can I debug php bin/console make:migration command freezing? - php

I am developing a web app using Symfony. I have successfully been using console commands fine with my project. I must have done something because now the command php bin/console make:migration freezes, with no output even in verbose mode. The command php bin/console make:entity works fine and makes me think there is something wrong with the database connection. Steps I have tried:
Make sure the DB version is present in .env file.
Restarted server
Deleted cache
Deleted entire project and cloned from git and ran composer install
The app still works as intended, but I cannot make a migration. The command simply hangs with no errors. Any suggestions on how to debug this?

You can add different levels of verbosity using the parameter "-v", as the Console list explains:
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Launch php bin/console make:migration -vvv to debug and see why it hangs.

It is not frozen. In this update, they have forgot to print the message.
The message is "Are you sure you wish to continue? y/i"
If you enter y and hit enter it will be continued.

Related

My changes not reflect my php code in my site with Laravel 8

It's been a few days now, that my changes in the code (controller, event, blade or any other php files) are not reflected at runtime.
For my changes to be taken into consideration, I have to close my code editor (VSCode) and open it again and type the command "npm run watch" even for PHP files.
My working environment is under Window 10 with VSCode, Laravel 8, PHP 7.4.
I specify that I have already tried the following commands:
php artisan config:clear, php artisan route:clear, php artisan view:clear, php artisan event:clear
That I have already deleted the VSCode cache manually and that I delete the cache of Chrome on every run, but nothing changes except close my project and reopen it and run the "npm run watch" command even if no such file is affected.
Does anyone have an idea for me, because I will soon have no more hair :-D?

How can I run php artisan serve using .env.production?

I have a Laravel Web Application, and it works just fine locally, using a local .env file that references the local database.
I have the same Laravel Web Application deployed in production, where I find a .env, which is different from the one that I use locally.
Both the scenarios work perfectly, but when I wanted to perform a test with the remote database (that I can access from my local IP address), I copied the remote .env and renamed it .env.production.
How can I run the php artisan serve using the .env.production ?
The php artisan serve help states that adding a --env parameter should make the trick, as you can see from the command result below
php artisan serve --help
Description:
Serve the application on the PHP development server
Usage:
serve [options]
Options:
--host[=HOST] The host address to serve the application on [default: "127.0.0.1"]
--port[=PORT] The port to serve the application on
--tries[=TRIES] The max number of ports to attempt to serve from [default: 10]
--no-reload Do not reload the development server on .env file changes
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
but the command php artisan serve --env=production still loads the local database.
What am I doing wrong ?
After some tests I found a working solution in a Laracast Forum, giving credits to a Laravel.io post that consists into running the following command:
APP_ENV=production php artisan serve
This causes the .env.production to be loaded and used by the local server, as needed.
I post this here hoping it will be useful to someone in my same condition.

File compiles successfully but changes don't get reflected in console

I'm trying to make changes inside of a .js file that of which compiles successfully according to npm run watch outputs. The change I made is inside of a console.log(); statement just to test out if my changes get reflected. I've tried cmd + shift + r because I thought it could've been cached but it seems that's not the case. What could be a reason why? I've tried running npm run dev as well but to no avail. What am I missing here?
try to restart your server
if a restart does not work then
php artisan cache:clear
php artisan config:clear

php artisan serve get cached or does not react while updating code in Laravel 5.5. After a restart, it works again each time

My IDE is phpstorm and running on WAMP Server. While coding, it does not show the expected response, always returns the previously requested response (In postman). Each time, I need to close 'php artisan serve' with CTRL+C and then run again to get the expected response.
I tried changing IDE, changing port but it does not work. Of course, I tired to save manually ( CTRL+S) but the problem persists.
I also tried the following commands:
php artisan cache:clear
php artisan config:clear
php artisan route:clear
composer dump
But the problem still persists.
The issue might be the composer command. Please, have a look on my setup in the Makefile:
run:
php artisan config:cache
php artisan config:clear
php artisan cache:clear
composer.phar dump-autoload -o
php artisan serve
And it's ready to go with a Laravel's "clean build".
Can you try with a diferent request tool, like doing a GET on your browser?
Or just create a new endpoint to test that. This way you make sure that changes are being saved.
I recommend you make tests to see if:
the problem is on your postman (a cache maybe?);
the problem is that your code isn't being saved;
the problem is on your local server (a persistent cache?);
My tip is: Try to eliminate the possible causes and you should achieve an answer.
Let´s try to make sure about above items and if them are ok, we check possible another ones.

Laravel/Lumen - missing commands in Artisan console

I have a problem with runing Laravel's Artisan. There are most of the commands missing. Everything worked fine till the last composer/code update.
For an example if I write php artisan migrate, I get following error: Command "migrate" is not defined.
Below is an example of output that I get by typing php artisan.
Laravel Framework version Lumen (5.1.6) (Laravel Components 5.1.*)
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
serve Serve the application on the PHP development server
schedule
schedule:run Run the scheduled commands
Does anyone have any ideas how to fix this?
It seems there was a problem with composer. Somehow composer.lock got into git ignore list and libraries used on production were different than the ones used in development.
The syntax has changed to php artisan make:migration.
You can see a full list of commands by running php artisan list

Categories