I am uploading a simple subscription page for my website using cPanel. I uploaded the files to public_html, moved the files from public folder and modify index.php so it points to the application. The PHP version I used to code this application is 7.3 but I had to select the 7.2 version in the host because that was the latest available.
When I load my website I get this error "This page isn’t working bazzaar.net is currently unable to handle this request. HTTP ERROR 500"
When I remove everything from the index.php file and add a simple echo the page loads.
I really need HELP with this. the error logs are below:
Stack trace:
#0 /home3/bazzaar/public_html/vendor/symfony/http-foundation/Response.php(198): Symfony\Component\HttpFoundation\Response->setStatusCode(500)
#1 /home3/bazzaar/public_html/vendor/symfony/http-foundation/Response.php(214): Symfony\Component\HttpFoundation\Response->__construct('<!doctype html>...', 500, Array)
#2 /home3/bazzaar/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(328): Symfony\Component\HttpFoundation\Response::create('<!doctype html>...', 500, Array)
#3 /home3/bazzaar/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(305): Illuminate\Foundation\Exceptions\Handler->convertExceptionToResponse(Object(Symfony\Component\Er in /home3/bazzaar/public_html/vendor/symfony/http-foundation/Response.php on line 450
my .htacess file
suPHP_ConfigPath /opt/php72/lib
Options -MultiViews -Indexes
RewriteEngine On
# 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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Use PHP72 as default
Assuming the cpanel has no other website and your laravel project is supposed to be the default project.
public_html
folderThis website might provide more details https://dev.to/asapabedi/deploying-laravel-5-applications-on-shared-hosting-without-the-use-of-ssh--16a6
You don't need to make changes to the structure of Laravel. Just copy below htaccess code and paste in .htaccess file at the root of your laravel project.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^$ public/index.php [L]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
</IfModule>
If you are using an Apache server you can do the following simple step
Step 1: just upload your all source code on the server (make sure database & .env set well) i) make zip and extract it ii) deploy code using git or take a clone from a repository and install all dependencies
Step 2: Make a .htaccess file on the project root directory and copy below code and paste it into this file.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
I get this answer from this video so please say thanks to him https://www.youtube.com/watch?v=6Qbd9HTh7AE (Thank you)
AS OF MAY 2020 LARAVEL 7.0
This is what worked for me:
Update the php version of cpanel to the requirements of laravel version say laravel 7.0 needs https://laravel.com/docs/7.x/installation
Check that all required extensions are installed
Then if you are having problems with .htacess, I recommend that you test by..
creating a simple index.html
just add a line like
Upload your database (assuming its already exported) by...
Go to MySQL Databases
create a database with the exact name of your database to be added
then create a MySQL user and give him all priviledges to the database
Go to phpmyadmin in cpanel and import the exported sql file
Zip your working laravel project and upload it to the home folder
In cpanel extract and...
PLEASE NOTE:
place all folders in the home
pick contents of public including .htaccess to public_html
WARNING: DON'T TOUCH YOUR index.php or server.php
Make hidden files visible in your cpanel then finally edit the .env file by...
Only editing DB username and password (I expect the DB name to be the same)
Also you want to leave APP_DEBUG as true for testing (YOU MUST TEST)
When all is well change it to false
If you have no database, what are waiting for refresh already
Though even with a Database NOWS THE TIME refresh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With