Need help?

Our experts have had an average response time of 13.14 minutes in February 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

7 reasons for Laravel “something went wrong” error, and how to fix them

by | Sep 25, 2018

During a new App setup, app migration or update, Laravel might show the error : “Whoops, looks like something went wrong.

Errors can be frustrating, but what makes it even more frustrating is when it is cryptic like this:

Laravel something went wrong

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

In these sites, we’ve seen a wide range of reasons for this error that ranges from missing PHP extensions to outdated composers.

Let’s take a quick look at the top 7 causes we’ve seen for this error, and how we fix them.

 

1. Missing PHP extensions

By default, PHP packages come with a minimal set of extensions.

During new App setup or migrations, we’ve seen cases where the app user forgot to setup all the required extensions such as OpenSSL, Tokenizer, etc.

This will cause the app code to fail, and Laravel to show “Whoops, looks like something went wrong.”.

Solution : In such cases, we go through the app requirement specs and make sure (1) the extensions are installed and (2) the paths to the extensions are set right in the PHP config used by the app.

 

2. Wrong file or folder permissions

Laravel apps write to cache and log folders during app execution.

For this to happen, these folders should have “write” permission set for the PHP user.

Depending on how PHP is configured in the server, it should be either “755” or “777” for these folders.

Solution : In servers that run PHP as the site user (eg. SuPHP), we set the permissions 755 for “storage” and “bootstrap/cache” directories. In others (eg. mod_php), we set it as 777.

Note :  There could be additional configuration settings for PHP that can invalidate the above rule. So, if you are not sure what the permissions should be, contact our Laravel administrator. We are online 24/7.

 

3. Application key not generated or invalid

Laravel uses a 32 character long “application key” to create user sessions and encrypt data.

This is usually automatically set when Laravel is installed using the “composer” tool.

However, during migrations or during non-standard setup, we’ve seen this key to be not set or copied incorrectly.

This causes the sessions to fail, and app causing the error “Whoops, looks like something went wrong.”

Solution : We create a new app key with the command php artisan key:generate and update the APP_KEY entry in the environment file (.env).

 

4. Environment (“.env”) file not set

Laravel stores the application settings in a file called “.env” in the app’s home directory.

Since this is a hidden file, it may get omitted during app migrations.

It is also possible that novice users forget to create this file during new app setup.

Solution : In the case of migrations, we copy the .env file from the source server, and in the case of new setup, we use the default .env.example file to create a new .env file.

 

5. Outdated composer

Laravel uses a package called “composer” to install, maintain and update apps.

Some app updates may require the latest version of “composer” to be available in the server. If not, the app update might fail showing the error, “Whoops, looks like something went wrong.”.

Solution : In such cases, we update the composer with the commands composer self-update or composer global update or composer update, depending on the kind of issue we’re facing.

 

6. Stale Laravel config cache

Often it takes many app reloads to iron out the small issues during new setup, updates or migrations.

The config files may change many times during these times. But Laravel might cache the old config settings, often causing the app to fail with the “something went wrong” error.

Solution : To fix this, we delete the config cache with the command php artisan config:cache. This will force Laravel to build a new combined config file using the latest versions of files stored under the config directory.

 

7. Code sync errors

App updates can sometimes get messy with broken paths and incorrect permissions preventing proper download of app files.

We’ve also see users making custom changes that cause syntax errors.

Any of these can cause the application to fail with the “something went wrong” error.

Solution : In such cases, the fastest way to resolution is to restore the old app version from backup. If that is not an option, we trace the files that were changed the last, and replace it with the unmodified versions from the app repository. We also check if this is a reported bug by the developer.

 

What next? – Enable debugging to dig deeper

When faced with the “something went wrong” error, our first step is to enable detailed error log by setting “APP_DEBUG” as “true” in app/config/app.php.

This gives us the exact reason for the error, and helps us resolve the issue in a few minutes.

However, these error messages can be pretty confusing for someone not familiar with Laravel development.

If you followed the steps above, and none of it seemed to work, you may need to dig deeper with the debugging. In case you need assistance, click here to request assistance from our Laravel experts.

 

Conclusion

Laravel shows the error “Whoops, looks like something went wrong.” for any error on the site. Today, we’ve covered the top 7 reasons for this error, and what we do to fix them.

 

PREVENT YOUR SERVER FROM CRASHING!

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.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

7 Comments

  1. Raymon

    It works for me, thank you! 🙂

    Reply
  2. levi

    Thanks it covered almost the problems during initiation;

    Reply
  3. Donizete Brandão

    Sua dica me ajudou muito. No meu caso, como havia migrado os arquivos, o arquivo “.evn” não migrou junto. Valeu, muito obrigado mesmo!!!

    Reply
    • Visakh S

      Obrigado Donizete pelas palavras amáveis! 🙂

      Reply
  4. HwyXingFrog

    My Issue, Hard Drive Was Full

    Reply
  5. shinu

    my problem is not fixed yet

    Reply
    • Sijin George

      Hello Shinu,
      We can take a closer look at your Laravel settings. If you still have the error and need help, we’ll be happy to talk to you on chat (click on the icon at right-bottom).

      Reply

Submit a Comment

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

Privacy Preference Center

Necessary

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]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

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
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

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
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF