Laravel 5.5 Error 500 in Cpanel Shared Hosting

Laravel 5.5 Error 500 in Cpanel Shared Hosting

First time, you can check your php info

<?php
phpinfo();
?>

and you can search "mbstring" in there...

mbstring

if mbstring still not installed, you can ask the provider to installed that.

if already installed and still got the error 500, better you must check your php version in phpinfo(). And clear your cache with php artisan command. when you have a permission to shell, you can try to check your php version with command "php -v" and see the default php with which php.

Laravel on a shared hosting server returns error 500

You moved everything inside your public_html folder which you should not do. Only files inside /public needs to be in public_html, hence the name public. The Laravel files should be placed higher directory where it is not accessible from the public.

  1. Install Laravel with Softaculous, or with composer via SSH in /home/username/laravel
  2. Move everything in /home/username/public_html folder to
    /home/username/laravel
  3. Move everything in /home/username/laravel/public to /home/username/public_html and delete the public folder after move.
  4. Edit this file: /home/username/public_html/index.php
  5. Change to require '/home/username/laravel/vendor/autoload.php';
  6. Change to $app = require_once '/home/username/laravel/bootstrap/app.php';
  7. Save this file and close window.

  8. Edit this file: /home/username/laravel/server.php

  9. Change to:

    if ($uri !== '/' && file_exists('/home/username/public_html'.$uri)) {
    return false;
    }

    require_once '/home/username/public_html/index.php';

Replace username with your hosting username. :)

Laravel 5 Server Error 500 Hosting in cpanel repost

check below screen shot rename server.php to index.php and take out all the public folder file i marked the folder and file to which need to take action enter image description here

in public except index.php take out all file/folder enter image description here

after that open .htaccess file it present in your main folder MyLaravelApp if not then just create new one and past below with you app corrections

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


RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} MyLaravelApp(folder name)
RewriteRule ^(.*)$ https://example.com/MyLaravelApp(folder name)/$1 [R,L]

# Handle Authorization Header
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]

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Max-Age "1000"
Header set Access-Control-Allow-Headers "access_token, x-requested-with, Content-Type, Accept-Encoding, Accept-Language, Cookie, Referer"
</IfModule>

this work for me hope it work for you too.



Related Topics



Leave a reply



Submit