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

novichun's avatar

Laravel HTTP ERROR 500 on live server

Hello Guys! I'm tryting to deploy a laravel application on a subdomain. Everything is fine with the versions of php and etc. But i can do anything, i always got an 500 HTTP error. I have already tried to change my public folder htaccess and index.php but it doesent work. If i change my public folder index.php to some random echo TEST, its displaying and works but it cant handle and display my app. So my webserver can reach the public folder but my app cant show. I show you guys some codes:

in public folder index.php:

<?php

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/

if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
    require __DIR__.'/../storage/framework/maintenance.php';
}

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/

require __DIR__.'/../vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/

$app = require_once __DIR__.'/../bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = tap($kernel->handle(
    $request = Request::capture()
))->send();

$kernel->terminate($request, $response);

in public folder .htacess:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On
RewriteBase /

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]

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

How can i solve this? I dont have any error logs. Thank you for your help.

0 likes
17 replies
Sinnbeck's avatar

Where did you look for logs? Only in laravel?

novichun's avatar

@Sinnbeck And on my web server too. And i only know that: Failed to load resource: the server responded with a status of 500 ()

Sinnbeck's avatar

@novichun I've never had a error 500 without a log somewhere. So which files did you check?

My best bet would be something like /var/log/php.error.log or similar. Or apache which is something like /var/log/apache2/error.log

jlrdw's avatar

@novichun make sure you have pointed to public as document root. And remember Linux is case sensitive.

I have already tried to change my public folder htaccess and index.php

What did you change?

novichun's avatar

[10-Jan-2022 20:09:44 Europe/Budapest] PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.7. in

I found this, and how can i solve it?

novichun's avatar

@Sinnbeck I got this:

PHP Warning:  Module "gd" is already loaded in Unknown on line 0
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
PHP Warning:  Module "gd" is already loaded in Unknown on line 0
Discovered Package: facade/ignition
Discovered Package: fruitcake/laravel-cors
Discovered Package: laravel/fortify
Discovered Package: laravel/sail
Discovered Package: laravel/sanctum
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
77 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Sinnbeck's avatar

@novichun ok seem like you have gd loaded twice. Shouldn't be breaking. Try turning on APP_DEBUG in your env file

Sinnbeck's avatar

@novichun so it's an apache or php error assume. Not laravel. What version of php are you running?

Add a file called phpinfo.php in the public folder and call it in the browser. Add this content to it

<?php
phpinfo();

Does the php version shown on the page fit with what you think?

Sinnbeck's avatar

@novichun ok so you changed something to make it work with 7.4? The error you posted told us that the composer install failed earlier as you had the wrong version

Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.7

novichun's avatar

@Sinnbeck I dont think.. i think the problem is that i use 8.0 php version on my laptop where i developed my app, and on my webserver where i want to publish the company where from i rent the server using a 7.4. but how can i solve this, that's i dont know :(

Sinnbeck's avatar

@novichun either downgrade locally to 7.4 and make sure the app works, or contact your server provider and ask them to upgrade you to php 8.0 (unless you manage the whole server yourself)

Sinnbeck's avatar

@novichun that depends on your dev environment. Xampp? Docker?

BTW. No guarantee that this will solve the problem. But it's best if your version match

jlrdw's avatar

@novichun There isn't a cpanel dropdown where you can change the php version?

Please or to participate in this conversation.