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

albro's avatar
Level 1

500 Internal Server Error

Hi, I have been working with laravel 5.5 on my localhost, Everithing works great But when i tried uploading it to server i get the error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

My .htaccess file looks like Options -MultiViews -Indexes

RewriteEngine On

# Handle Authorization Header
RewriteBase /

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Anyone with an idea on how to fix this?

0 likes
15 replies
tykus's avatar

Could be anything, check your logs. Do you have the required environment variables set; APP_KEY, DB credentials etc.?

1 like
albro's avatar
Level 1

@tykus Might you be talking about

APP_NAME=name APP_ENV=local APP_KEY=base64:BlzeVVoUvTrLboWRFDlpoxK0oF/Ru/YR3JUsrezoaTo= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost

tykus's avatar

Yes; although .env is really a development convenience rather than something to use in production environment - you can set Environment Variables directly on your production server instead.

Did you check the storage/logs/laravel.log for any information regarding the 500 error?

albro's avatar
Level 1

I have checked the error log this is the last line

/home/desgnekta/PrimeEducationalCenter/server.php(21): require_once('/home/desgnekta...')

Something that confuses me is that the path "/home/desgnekta/" was in my local machine but the same path appears in the remote server What could be the problem?

1 like
tykus's avatar

No. More likely you have uploaded the log from your development environment. You can empty the laravel.log file on the server, and check again after making a request.

1 like
albro's avatar
Level 1

I have tried emptying the logs then tried making a request, But still empty, There are chances that the logs are not being written at all

tykus's avatar

That is possible, yes. It could be an issue with permissions (your web server user does not have appropriate permissions to write to the logs).

It could also be that the Laravel app is not being served at all! You could quickly test this checking if something in your app's public directory (e.g. an image or css file) is accessible in a web request.

Depending on your server setup, there should also be error and access logs available for you to check. Have a look in /var/logs/... if you are on a *NIX server

2 likes
albro's avatar
Level 1

I tried Accessing an image in the public folder "public/uploads/images/1.jpg" I get an error

You don't have permission to access /prototype/public/uploads/images/1.jpg on this server. Server unable to read htaccess file, denying access to be safe

tykus's avatar

So there you have it... permissions. How did you upload your project to the server?

albro's avatar
Level 1

I did it manually...Zipped it up in local machine then uploaded then unzipped from the server

tykus's avatar
tykus
Best Answer
Level 104

If you ls the project, who owns the files and directories (i.e. what are the user and group permissions)?

I don't know your exact production environment so giving a specific answer is difficult; but use the following as a guide:

On your server, set the ownership of the laravel project as you and group to the apache user:

sudo chown -R your-user:www-data /path/to/your/laravel/root/directory

Set the permissions for you and the web server:

sudo find /path/to/your/laravel/root/directory -type f -exec chmod 644 {} \;
sudo find /path/to/your/laravel/root/directory -type d -exec chmod 775 {} \;

Next, give the web server user read and write permissions to the storage, cache and any other directories it will need to write to:

sudo chgrp -R www-data storage
sudo chmod -R ug+rwx storage
2 likes
webtrickshome's avatar

Generally the internal server error is displayed when the server can't find out the exact error. The one I got when I tried to upload a project for the first time was due to the difference in php versions. Check the php version that your server is using. If it's less than 5.6 then internal server error is displayed.

From the control panel php version option, set it to 5.6 or higher and your problem will be resolved.

1 like
albro's avatar
Level 1

@tykus i have tried setting the permissions but still the same results @webtrickshome I user php 7 in development and i have set my php version to 7.2 in my php package manager in the c panel but am getting the same results

tykus's avatar

Ok. You need to get down to basics here. Find the web server's logs and see what error(s) are coming back whenever a page is being requested.

1 like
albro's avatar
Level 1

Thank you all, There was an issue with permissions.Your contributions helped alot Cheers guys

Please or to participate in this conversation.