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...
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.
- Install Laravel with Softaculous, or with
composer
via SSH in/home/username/laravel
- Move everything in
/home/username/public_html
folder to/home/username/laravel
- Move everything in
/home/username/laravel/public
to/home/username/public_html
and delete the public folder after move. - Edit this file:
/home/username/public_html/index.php
- Change to
require '/home/username/laravel/vendor/autoload.php';
- Change to
$app = require_once '/home/username/laravel/bootstrap/app.php';
Save this file and close window.
Edit this file:
/home/username/laravel/server.php
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
in public except index.php take out all file/folder
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
How to Resolve a Http 414 "Request Uri Too Long" Error
Regex for No More Than 5 Digits or Contain String
Download a Facebook Video (.Mp4) Via PHP
Apache Virtual Host Always Redirecting to /Dashboard
Displaying Data from an Array in a HTML Table Using PHP
Laravel: Pdoexception: Could Not Find Driver
Session Destroy When One Browser Tab Gets Closed
Auto Update Cart on Quantity Change in Woocommerce Cart Page
Laravel Storage Link Won't Work on Production
Comparing Date from Variable to MySQL Date
Curl (7): Failed to Connect to Localhost Port 8000: Connection Refused
How to Store Values from Foreach Loop into an Array
How to Get Part of Url Before Last Slash With PHP
How to Capitalize First Letter in Laravel Blade
Group Array Data on One Column and Sum Data from Another Column