I need to run php artisan config:clear on my app that is online, the only issue is that I have only the FTP credentials and DB, and not the SSH to run on the terminal, how can I run this command without the terminal?
Already tried looking on the forum and didn't found any question related with my issue but didn't found any answer for it.
You can call the artisan command from anywhere in your PHP code block.
$exitCode = Artisan::call('config:clear');
More info can be found here https://laravel.com/docs/5.4/artisan#programmatically-executing-commands
That artisan command is only a helper to let you clear out the cached files.
You should be able to clear the config cache yourself, by removing the file config.php from folder /bootstrap/cache/ in your project.
Related
I have a laravel project but when I use the command "php artisan serve" and type the url: http://127.0.0.1:8000/ , its just keep on loading without output nor error appear.
I solved this by running this command instead of PHP artisan serve.
php -S 127.0.0.1:8000 -t public/
Then try to load again 127.0.0.1:8000 in your browser.
Try disabling your anti-virus or check your firewall.
I disabled my Avast anti-virus and it's working fine for me now.
The port 8000 might be used by other in your computer. Try to change port by running in your project in cmd:
php artisan serve --port=1000
then type http://127.0.0.1:1000/ on your browser.
Run commands
php artisan config:clear
php artisan config:cache
Even after completing these steps, if Laravel is still showing error, check your_project/storage/logs/laravel.log.
Try these three commands for clearing cache config:
php artisan config:cache // clear config cache
php artisan config:clear // clear config cache
php artisan cache:clear // clear cache
php artisan optimize // To reoptimize the class loader
php artisan route:cache // clear route cache
php artisan view:clear // clear view cache
It sometimes happen because of too many redirection and also sometime because of middleware . so see your whole flow for that page.
Also see your cdn which included in your page because it take too many time if you have too many cdn and your connection is slow. And also try to clear all cache.
I experienced this problem also when I first launched out into Laravel.
Your port 8000 is most likely occupied by another service or program.
Simply go to your terminal where your project is open, and enter the following command
php artisan serve --port=1000
Then, return to your browser and enter the address, replacing 8000 with 1000, as in
127.0.0.1:1000
This worked for me.
There are several issues may be possible for that.
You have used CDN JS and CSS
Check you route/web.php
Check you log error log file storage/logs/laravel.log
Check above points this will sure give you positive result.
In my case I uninstalled Xampp and reinstalled it(I'm assuming you are using Xampp too).It worked for me.
If you are using xampp
just restart Apache and MySql
I have been working on a project for about a month. There have been no major issues. We are about to launch.
An error was reported that a route was not working as intended on staging. I tried to replicate it locally by putting the route into my browser ( but obviously with the local domain path ) and it didnt work. this is the order of events:
that route was causing a permanent redirect. Code looked fine but i noticed the intended get did not seem to be hitting so I put a dd('test'); after it and refreshed and saw the test. So it was bypassing its intended route::get, which was not happening before.
I tried figuring this out, clearing cache and the normal things that could cause this. I then killed the server ( locally ) shut down terminal and restarted it, now everytime I try to run anything it responds with http://localhost
CO!!##!##!##:directoryproject username$ php artisan cache:clear
"http://localhost"
CO!!##!##!##:directoryproject username$ php artisan config:clear
"http://localhost"
CO!!##!##!##:directoryproject username$ php artisan serve
"http://localhost"
CO!!##!##!##:directoryproject username$
i cannot get anything to work. I tried checking out a different branch, nothing. Composer update, install nothing. I keep getting:
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
Any help would be greatly appreciated at this point.
You've likely got a dd statement somewhere like dd(request()->getHost()); or similar. Do a recursive search starting in the app's root directory for the pattern dd(. If that doesn't yield anything, start at the very top pulic/index.php and put in dd(__DIR__); statements and attempting to access the app. Then move onto the service providers, http kernel, etc. until you can locate the culprit code.
I was playing with Laravel by refreshing the page 10 times in a second and did this many times continuously. I got the below error
The only supported ciphers are AES-128-CBC and AES-256-CBC with the
correct key lengths.
This is a test case which can occur anytime by end user also. Is there any way to fix it?
I already have key in my env file. This issue occurs only when i refresh the page again and again,
I already checked the answer but could not help
As posted by one of the users at this issue at GitHub,
Under a heavy load of requests, two async requests are made, and during the second request the .env file is locked, so you receive the error only for that request.
To solve this, you can create a cache using below command, which will bypass your .env file on further requests.
php artisan config:cache
Run following command from application folder:
$ php artisan key:generate
First make the key if doesn't exists by running following command.
php artisan key:generate
Next clear your config cache.
php artisan config:clear
Propably application cached your config without app-key.
Did anyone has issues with env variables? For some reason, helper env('VARIABLE') returns null every time I use it. It happened very unexpectedly and I dont really know the reason. Restarting the apache/IDE/computer does not work.
Run those of command
composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear
Now try to read
$value = env('VARIABLE_NAME');
if not working till now then,
Try another syntax to read env variable.
$value=getenv('VARIABLE_NAME');
The solution is simple, but neither the IDE nor the debugger says anything about it. It just returns null. When you use php artisan config:cache, according to the documentation:
If you execute php artisan config:cachecommand during your deployment process, you should be sure that you are only calling the env() function from within your configuration files.
Obviously I have env variables outside the config files, so after caching I was not able to use it outside anymore. The php artisan config:clear puts it back to work.
What I've found more about the usage of env, that it should be used only within config files. You can access env variables from the rest of the project using other helper method config(). Be sure to assign it to another key in config file, e.g. 'key' => env('CACHE_DRIVER')
What is more, you have to remember to run php artisan config:cache each time you will change .env file. Laravel will not load the new values, until it's cached. If it's not cached, no need to do it.
please use this its work for me use git bash or cmd and past this command
$ rm bootstrap/cache/config.php
this command clear cache folder
Just run
php artisan config:clear
It solved my issue.
In my case, it's just because I'm using php artisan serve, just restart it, the server command may read the env and keep at the startup time.
I have been working on a laravel5 project on a computer , but now I want to continue on an other, but don't know how :(
I'm using wampserver and the project is in the "www" folder, this is the error I'm getting when trying to open the project: " Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request"
Your error message is very vague, so it is hard to pinpoint the cause. I assume you just copy pasted all of the project files
Try these steps:
Make sure you copy all of the project files including the hidden ones(.env).
Prepare your destination computer as in http://laravel.com/docs/
Check you have all the necessary PHP extensions available in php.ini as in above link requirements. Also, watch your PHP version!
Install composer https://getcomposer.org/doc/00-intro.md
When copied, go to your destination folder and run composer install.
Run php artisan key:generate from the command line.
Run php artisan cache:clear from command line
http://php.net/manual/en/install.windows.commandline.php
Make sure your webserver is serving pages from project/public folder.
If laravel is failing, check the log file to see the cause
your_project/storage/logs/laravel.log
Copy the project folder and navigate terminal/cmd
just run following commands.
Create database and place the same name at .env file in laravel project folder
1. composer install
2. php artisan key:generate
3. php artisan cache:clear
4. php artisan migrate
UPDATE: If you're getting
Whoops, looks like something went wrong
in app/config/app.php, set debugging as true with:
'debug' => env('APP_DEBUG', true)'
If you're getting the error
No supported encrypter found. The cipher and/or key length are invalid
for some people it worked to do cp .env.example .env before (2).
You would also have to create new storage link, because Laravel uses absolute path inside it.
php artisan storage:link
https://stackoverflow.com/a/32722141/3982831 Please follow this to resolve your problems. All people forget about permissions on folders.
After you have done as Ademord answer, you might need to use refresh to your WAMP, XAMP or any other development stack you are using. I had the same issue plus changes were not reflecting in the front end. For example new routes in the web.php were not updating.