Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Magalliu's avatar

I got '500 Internal Server Error' after transfering my project on server.

Hey everyone, I hope you doing well! I got this problem, I got my project transfered to server. I already made composer install, php artisan key:generate, created and configured .env file.

Yes I did give permission to storagefolder and logs. I did run php artisan cache:clear and php artisan config:cache.

Already run php artisan migrate and php artisan db:seed. I think that I did everything good but I still got 500 Internal Server Error . Can anyone suggest what to do or have any opinion about what can cause this 500 Server Error? Thank you!

1 like
24 replies
lacasera's avatar

have you checked the logs file, and what is in there? and also which provider are you using ?

Magalliu's avatar

There is nothing in logs file, only an error about my migration but that was solved before.

In fact I'm using my company's server and I dont know what to say about the provider...

Tray2's avatar

The 500 error should give you some information about what is going wrong in the logs.

Check the apache/nginx logs on the server.

Magalliu's avatar

In fact I don't have permission because I'm an simple user on my server (I'm limited to my own project folder). We got a sysadmin who manage everything. I already talked to him and he said that must be some configuration issue.

Tray2's avatar

You have an error in your code plain and simple.That is what a 500 error means. If you have show php errors turned of in the php.ini on the server (like you should have for production) then it should be recorded in the webservers logs. Ask him to either send you the logs or check them for you if he doesn't want to give you read access to them (which I think you should have for trouble shooting).

If it runs fine on you local dev machine then there is probably something that is missing on the prodserver that the app expects to be there. It could be a value in a database table, a php dependency that you are referensing that is installed on the prodserver.

Maybe one of these are missing

https://laravel.com/docs/8.x/deployment#server-requirements

1 like
alanholmes's avatar

Hi @marinario

If there is nothing appearing in the logs that you can see, and you can't get any information about the server logs, another option is to temporarily change APP_DEBUG to true in your .env which should show you the error on screen.

Just don't forget to change it back to false :)

This is what I do after a release if I get any errors (and its usually down to some folder permissions)

Magalliu's avatar

Hi @alanholmes, thank you for your answer.

In fact I already have APP_DEBUG set to true in my .env because I already see on logs some errors I had with migrations that were solved. Maybe it's time to talk with my sysadmin to show me webserver logs.

Magalliu's avatar

Thanks for replying @tray2 again!

In fact, without configuring the .env file, the static pages that do not retrieve data from db, worked fine.

After setting up the .env file and running the migration, I ran into this problem. I apologize for not having specified this earlier!

I don't know maybe it's better to ask sysadmin for server logs.

Tray2's avatar

That is a good start. If you had issues with your migrations it might be that some table is missing or some field is missing in the database.

If it's so the logs will tell you that no such table or column exists. If you use seeders check that they work as intended as well.

Magalliu's avatar

I checked the tables, the migrations and the seeder, all works as expected. And if I would had any migration, database issue that would be registered on logs but no new errors are there.

munazzil's avatar

Have you tried with below commands,

       php artisan optimize
       composer dump-autoload

if you have vendor file then try with,

      php artisan vendor:publish and then enter button , After enter 0 then enter button.
Magalliu's avatar

Thank for the answer @munazzil!

Yes I've tried those commands but did not worked for me...

Magalliu's avatar

I should say that I can refresh migrations and run seeders again and again without any problem.

Maybe the issue should be on .envfile.

This is how it looks:

APP_NAME=project_name
APP_ENV=production
APP_KEY=app_key_here
APP_DEBUG=true
APP_URL=host_domain_url

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=localhost
B_PORT=3306
DB_DATABASE=db_name
DB_USERNAME=username
DB_PASSWORD=db_pass

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=sendmail
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=example
MAIL_ENCRYPTION=tls
[email protected]

AWS_ACCESS_KEY_ID=

AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

DATATABLES_ERROR=throw
Tray2's avatar

I don't know if it's copy paste error but there is a D missing on the port B_PORT should be DB_PORT

Magalliu's avatar

Yeah, copy paste error on my original .env already got it DB_PORT.

munazzil's avatar

remove this field and check DATATABLES_ERROR=throw. And App Debug should be false in production. APP_DEBUG=false

Magalliu's avatar

@munazzil I removed as suggested but did not had any effect. Still same 500 internal server error.

I know but this its just for testing purposes. I'm leaving it to true only for debugging right now.

Tray2's avatar

I think it's time for you to get your louisville slugger and a boom box playing Ramones - Beat On The Brat and walk over to your sysadmin and demand the logs.

1 like
Magalliu's avatar

This could be marked as the best answers :P

And yeah it's now or never with my sysadmin :P

1 like
munazzil's avatar

Try with below commands and hard refresh your server,

php artisan view:clear
php artisan config:clear

and then run ,

     npm install
     npm run dev
Magalliu's avatar

I tried this in the first lines on index.php inside public folder where the app initialize:

phpinfo();
die();

It will show me the php info but when I remove this lines still same error.

Magalliu's avatar
Magalliu
OP
Best Answer
Level 2

Thank you to everyone who tried to help me! I found where the issue was finally.

I had to set permissions also to bootstrap folder and everything works like a charm.

That in fact is the result of my Louisville slugger and Ramones - Beat On The Brat as suggested by @tray2, so I'm going to mark that answer as the best asnwer :P (not doing it just to help someone else if will have same headache as me and to directly see the correct answer)

Please or to participate in this conversation.