Laravel Project is not working on Server

Username (e.g. epiz_XXX) or Website URL

Account Username: epiz_28057870

Error Message

I have properly configured Laravel project on the server, directly from my local to live server. But it is showing Whoops something went wrong. While checking in detail I found that .env file is not working properly. Laravel code which uses enviroment variables are not working [e.g. env(‘DB_USERNAME’), env(‘DB_PASSWORD’) etc ] are not working. and it seems .env file is not getting autoload.

Other Information

Laravel version - 5.4
PHP Version - 7.4

putenv/getenv from the autoload.php isn’t working and hense it is not loading .env variables

Hi and welcome to the forum

For more please search the forum


I didn’t disable putenv(),
During checking it seems that I am unable to use those functions from the server side.

Odd, I remember Laravel specifically having a workaround in place that made the .env file work even if the putenv function was disabled.

Although I think I checked that on a more recent version of Laravel. The latest version of Laravel is 8.5, and the first version of Laravel 5.4 was released four years ago.

So maybe this can be fixed by just updating to a newer Laravel version? I would say that it’s overdue anyways.


May be it is the reason. But As I can see on server side putenv function is disabled and it is not allowing me to work with SetEnv or GetEnv functions. What is the solution to work my Laravel 5.4 project right away!

my domain is

update laravel

Can’t possible to update

Since you’ve worked on it through localhost, it would be easier to update it through there first before uploading it to the server.


Can I update to 5.8.* and will it work?

I don’t know. I know that a workaround was implemented in Laravel to load the config without using the putenv function, but I don’t know in which version.

But Laravel 5.8 is still old. You’re going to have to upgrade to Laravel 8 at some point, so I would just suggest to get that over with.

You can also try upgrading to 5.8 and see if that works. If it doesn’t upgrade to Laravel 6 and see if that does. Rinse and repeat until you’re at the latest version.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.