Select Page

How to clear config cache in Laravel using Artisan

Many Laravel site users come across the dreaded “Whoops, looks like something went wrong.” error message when mirgating or upgrading their site or software.

Laravel error message

Here at Bobcares, Our Dedicated Support Engineers maintain hundreds of Laravel sites of web hosts, web designers, online publishers, and more.

In these sites, we’ve seen a wide range of reasons for this error that ranges from misconfigured .env file to messed up PHP engines.

But many of these errors could just be the stale config cache that was left over from the old site.

So, a quick cache clearing can get your site back online.


How to use Artisan in Laravel to clear config cache

Before we get into the details, here’s a quick reminder of what these terms mean:


What is Artisan?

Artisan is a command line tool provided with Laravel to administer your web app code.

If your site was setup for you by a developer, it’s best to leave Artisan alone.

For this tutorial, you only need to know one command.


What is Laravel Config Cache?

Part of why developers love Laravel is because of its modular nature.

Many devs create modules for each function in the site, and store their configuration in separate config files.

All these configuration files are stored under the config directory.

But having to read through all config files can slow down the site.

Laravel provides a way to merge all config options into one file to speed up the website.

This is done using the command php artisan config:cache AFTER the code is deployed and the .env file is created.


Why should you clear the configuration cache?

Some configuration entries (such as database name or file paths) could be server dependent, and sometimes after migration (or upgrade), these entries can change.

You might change these values in the configuration file, but Laravel could still refer to the old values.

So, it’s best to just clear it.


How do delete cached Laravel config file

This is the point where you’ll need to use your command line access and execute this command:

php artisan config:clear

Now, if you don’t know how Artisan works or are unfamiliar with command line, click here to get a Laravel admin to do it for you.

If you are on a Shared Hosting account, or if you do not have the privileges to execute that command, you can delete the cached config file.

It is located at bootstrap/cache/config.php.


Bonus tip : How to clear application cache

Sometimes, it’s not the stale configuration entries that cause the “Whoops, looks like something went wrong.” error.

We’ve seen incompatible entries in the application cache also playing spoil sport.

So, it’s a good idea to clear that as well.

Again, head over to the command line interface, and issue this command:

php artisan cache:clear

If your site’s error is related to cache, these two commands should fix it.

Go ahead and reload the site.


None of this worked!

OK, don’t worry. There are a lot of other reason why Laravel could be failing.

If you need a quick solution, click here to consult our Laravel administrators. We are online 24/7 and can get on your case within a few minutes.

However, we would suggest that you consider getting a Server Administrator for your company who can monitor your server, perform falwless upgrades, and keep your server fast & secure.

If you need to talk to us about your site, click here to send us a mail.




Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.

Privacy Preference Center


    Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

    PHPSESSID - Preserves user session state across page requests.

    gdpr[consent_types] - Used to store user consents.

    gdpr[allowed_cookies] - Used to store user allowed cookies.

    PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]


    Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

    _ga - Preserves user session state across page requests.

    _gat - Used by Google Analytics to throttle request rate

    _gid - Registers a unique ID that is used to generate statistical data on how you use the website.

    smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

    _ga, _gat, _gid
    _ga, _gat, _gid


    Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

    IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

    test_cookie - Used to check if the user's browser supports cookies.

    1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

    NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

    DV - Google ad personalisation

    IDE, test_cookie, 1P_JAR, NID, DV, NID
    IDE, test_cookie
    1P_JAR, NID, DV