I have been working on deploying my Laravel app on a shared hosting using cpanel. However, I an getting this error:
[08-Sep-2018 07:38:43 UTC] PHP Fatal error: require(): Failed opening required '/home/daankraa/public_html/../../supersax/vendor/autoload.php' (include_path='.:/opt/cpanel/ea-php71/root/usr/share/pear') in /home/daankraa/public_html/index.php on line 24
From what I can see here is that it doesn’t want to switch to the root directory, but keeps looking for:
/home/daankraa/public_html/../../supersax/vendor/autoload.php in public_html.
I have tried the dots to move up a directory, but it doesn’t want to. How can I fix this?
Thanks in advance!
Daan
4
Answers
1) Copy
.htaccess from public folder to root
2)
rename server.php to index.php
server.php file would be in root
Simple 🙂
Move you all content from public to root directory and index.php file of public folder modified according like:
index.php
Here is a very simple method that worked for for me:
create a .htaccess file in the public_html folder (the file is same level with .env file)
copy and paste the following code in the .htaccess file
Save the file. That’s All you can now visit your site http://www.example.com
Note: for some reason if it does not work the your document root might be different the you will have to use the full path to the public folder you will replace: {DOCUMENT_ROOT} with the full path /var/www/example.com/web, you can get the full path by creating a file in the public folder of laravel called get_doc_root.php and inside of that file paste the code
the you can see your path by going to http://www.example.com/public/get_doc_root.php after getting the path just copy it and replace {DOCUMENT_ROOT} in your .htaccess created.