php artisan up command not working in laravel? - php

I have this very strange problem in laravel. I successfully put my website into maintenance mode via artisan by this command:
php artisan down
But now i have to put my website back into live mode.I tried:
php artisan up
However, the site isn't going live even though i get success message? Have you guys ever faced this issue?
Whats the fix?
I'm on :
1. Macbook pro Mamp
2. Laravel 5.1
Thanks

artisan up command simply deletes storage/framework/down file. Please check if the file exits after you execute the up command. If it still exists, it seems like a file access issue. Whenever you run down/up commands, make sure that you run them as the same user that is running your application.
In order to get the site up and running again, remove the storage/framework/down file manually.

Related

Laravel PHP run php artisan serve automatically if something changes

I am using laravel for a php webproject.
Yesterday I noticed an issue:
Everytime I make changes f.e. in the controller files I need to rerun php artisan serve, which consumes a lot of time (close CMD, open it again and type php artisan serve)
I am trying to find a way, so this command will automatically rerun when I test my application on localhost.
I could probably write a script or something with Python, which will automatically open CMD and execute php artisan serve whenever I click f.e. CTRL + F5, but that feels very hacky, is there a cleaner solution?
I also found a guide on how to edit the hosts file in system32 folder and the httpd-vhosts.conf in the apache folder, but after doing all steps, if I try to reach my application I get "It works" instead, which is simply an indicator for a successfull apache installation.
You should avoid php artisan serve cause it's just a shortcut to run your Laravel project. For a better development environment, you should use Laravel Homestead which offers a complete solution.

Laravel app won't update database connection settings

I have a Laravel app, been using a specific set of database settings for a very long time, now I uploaded the whole application to CPanel and trying to change both the .env and .env.example files but still, when I look at the error logs uses the old database details, am stuck. Thanks in advance.
After cracking and scratching my head several times, I actually used these laravel CLI commands
php artisan config:clear
php artisan cache:clear
Now everything is working okay. Of course I took it offline first and used htdocs until it worked okay then uploaded the latest files.
I'm not sure if you are using the latest laravel framework 5.4 but you can try the following:
Clearing the config cache with this artisan command
php artisan config:clear
Checking the environment
php artisan env
With this command you can make sure that you are running under the correct environment. If you are using specific .env file such as ".env.local" or ".env.dev" etc.
Make sure there's nothing wrong with your dbms installation and try to connect to another blank db.
Hope this helps you!

Laravel 5 - How to create queue table with Command Prompt in Windows 8.1

I am using Laravel 5 on my local with Windows 8.1. I successfully installed laravel with windows, it was hard because laravel's official documentation never talk about windows. However, I want to add a new table in my Database using Artisan Command. As you can already guess, it's not working on PC. I open command prompt as administrator and type this :
php artisan queue:table
This is probably working on a Mac or Linux but not on Windows...is there any artisan command to do the exact same thing but for PC?
I actually just need to create this table and I can't find anywhere the structure of this table. Thx!
Step 1
You have to have PHP installed and be able to run in from the command prompt. Test that by typing:
php -v
If you get a version number and some other details proceed with Step 2, otherwise follow this tutorial on sitepoint at least until point 4. The most important part being the adding of your PHP directory (where php.exe is located to the PATH system variable). After doing that, make sure to re-open CMD.
Step 2
Artisan is actually just a normal PHP file with no extension. You have to be in your project directory to run it. Make sure that's the case.
> cd C:\Path\To\Laravel\Project
> php artisan queue:table
Step 3
If you get some kind of error from php artisan * the next step mostly depends on that error. If it can't connect to the DB for example, you should first make sure that the credentials are configured correctly. If you have an error you don't understand, look it up online and if that doesn't help, post it along with your question.

Laravel migrations table not found

I'm trying to recover a project after a failed HDD. Lost the mysql information, so just have the project code.
I hoped to be able to put my database back together by using artisan migrate, but the error message tells me:
database.migrations doesn't exist
Is there actually a way I can use my Laravel code files and the command line to rebuilt my database like this?
Thanks for the help.
The command I needed to run was:
php artisan migrate:install
(I actually had more problems than this because the mysql install was messed up to. I don't know if simply php artisan migrate on its own would have implied :install but I'm adding it as an answer anyway should anyone have similar issues)

Laravel 4 development server crashing without notice

I am developing an application in Laravel 4 using the built-in development server with a SQLite database. After a recent merge from another user in the project repository, the server will crash after certain requests.
I believe I have narrowed it down to a call of Sentry - when it is used on a request the server will crash out and the command line will exit.
$ php artisan serve
Laravel development server started on http://localhost:8000
Dwight at Dwights-MacBook-Pro.local ~/Sites/tmtbl on master*
$
As you can see, there are no error notices.
I've run composer update and ensured that Sentry is still installed correctly. I'm not sure whether this issue is Sentry specific or something else is going on. Is there something I am missing here that is causing the server to crash?
Do you use Chrome? If yes, go to the console and if you have an error, is it the same as: Failed to load resource when using Auth? Because I have the same problem with the php 5.4 server
You can use the Google Chrome browser to see the errors in the console.
Process
First run: php artisan config:cache
Second run: php artisan serve
Finally: go to your localhost and inspect your page, and then go to the console in the upper tab, you might be able to see the error.
Image of console:
Moreover, you can try:
composer dump-autoload

Categories