please guide me how to upload the Laravel project to my cPanel I am very much confused.
you should add all the folders of laravel inside of public_html folder, and you need to move index.php and .htaccess file to the public_html directory from public directory. Now make changes index.php like this.
require DIR.'/bootstrap/autoload.php';
$app = require_once DIR.'/bootstrap/start.php';
That may work for you.
If you check your laravel project, there is a public folder inside it.
By default, your domain is pointed at the root level or on public_html. On you cPanel Domain settings, make sure your domain is pointed your Laravel application public folder.
Related
I want to deploy the Laravel project to my shared hosting.
When I go to my site main domain (example.com) It displays all directory and files but (example.com/public) works fine.
What if I just create an index.php file in the project root directory with following code
<?php
header('Location: ./public');
?>
It just redirects me to example.com/public.
Just tell me if there will be an issue that may occur at any point?
I am new to Laravel.
I don't care to remove the public directory. I only care if someone goes to example.com then it just redirects example.com/public to work fine.
Update
Just keep it short and simple answer (Yes/No) then explain it.
Is there will be an issue that occurs with the above steps (actions)? (Yes/No)
did you point your vhost to to the public directory?
For Apache
DocumentRoot [Laravel root direcoty]/public
For Nginx
root [Laravel root direcoty]/public;
Laravel Deploment
I'd suggest the easy way, by create a symbolic link of public_html and link it to your laravel project's public directory. don't forget to set your project folder permission.
here's the example: https://blog.netgloo.com/2016/01/29/deploy-laravel-application-on-shared-hosting/
I have project on localhost and I Need someone can help me to deploy lumen framework to hosting, i have been search in google for deploy lumen but i just found deploy laravel, maybe laravel and lumen is the same framework but i don't know how to deploy the lumen framework to my shared hosting in subdomain.
I have be been upload to :
/home/usernamecpanel/lumen
and public folder i put to my subdomain like
/home/usernamecpanel/public_html/subdomain/index.php
/home/usernamecpanel/public_html/subdomain/.htaccess
but i just got error 500.
oh, before i run i have been edit index.php to directing to lumenproject :
$app = require __DIR__.'/../../lumen/bootstrap/app.php';
I really confuse and i have been search in few day but cannot found the solution, i think someone can help me.
thank you.
Thanks for reviewing my edit
How to Fix it?
Zipping your Lumen Project
Go to your shared hosting file manager
I assume your shared hosting file manager have this directory structure like /home/username/public_html.
Create a folder outside public_html or htdocs, the folder name is up to you, example "myfolder" the structure looks like /home/username/myfolder
Upload your project to the new folder you have been created and unzip.
After unzip, inside the "myfolder" there is a folder named "public", move the contents inside to
For Main Domain
/home/username/public_html
For Subdomain or Subfolder
/home/username/public_html/sub
After moving those files, edit the index.php inside /home/username/public_html or /home/username/public_html/sub
Inside the file you see this code
$app = require __DIR__.'/../bootstrap/app.php';
change the code to
For Main Domain
$app = require __DIR__.'/../myfolder/bootstrap/app.php';
For Sub Domain/Subfolder
$app = require __DIR__.'/../../myfolder/bootstrap/app.php';
Don't forget to edit the APP_URL in .env file inside "myfolder"
Example the APP_URL .env file
APP_URL=http://yourdomain.com or http://sub.yourdomain.com or http://yourdomain.com/sub
I not got any answer from stackoverflow, and doesn't one onswer my question in stackoverflow, so i try hard find own solution with manual upload my lumen application in my shared hosting.
just put your lumen application in outside public_html and put your index.php file to subdomain and edit index.php set route to your subdomain.
if anyone have problem like me and read this question, you can ask from this question, i will help you if i got notice from this page.
You will need to move it with FileZilla to a subfolder inside /var/www/html/foldername and set configuration to the directory, but I wouldn't recommend you to set up a Micro Service in Shared host.
Hi I have my website which its my resume and now I want to show the project that I have done one of my project is laravel and I move it to: public_html/laravel
and also move my DB to there but I get this error:
403 Forbidden
You don't have permission to access /laravel/ on this server.
I don't understand is it because of I didn't put files on main public_html and move it to folder or other stuff I also changes(i don't know if its right) change config/database.php mysql part to database configuration but I keep getting this error
Laravel server files from the public/ directory. So try a URL like this instead:
http://example.com/laravel/public
If that works, you'll need to move some files around a bit. This should help with moving things around:
How to change public folder to public_html in laravel 5
If you use shared hosting then please do not uplaod whole laravel application to the publitc_html folder. You have to upload your all application at global document root for your domain like home/yourdomainand you have to rename existing public_html folder to any name and rename laravel public folder to public_html and try again. See the image below:
I am new to Laravel and started learning v5 few months back. I have created a sample application and want to deploy it over production (Shared hosting).
The easiest way for me is to put all content including app, vendor, config, tests etc folders directly to public_html but I don't want to do this. I want to keep laravel specific things outside the public_html and put only content from public folder to this directory.
What are the options available to do this?
Also, can I share same laravel installation for multiple applications?
on public/index.php add after
$app = require_once __DIR__.'/../bootstrap/app.php';
this:
$app->bind('path.public', function() {
return __DIR__;
});
Now You can change public directory to public_html
Keep your code outside of the public_html and create a symbolic link from public_html to the public directory in your laravel directory.
Is there anyway possible to install a Laravel PHP application into the same directory?
What I mean is as I see it, you have to install the whole Laravel application 1 directory under the the main Public directory.
I know that you can change the Public directory to anything in the settings but the server my client has, they really need for everything to live in 1 directory.
Current Folder Structure....
app/
bootstrap/
vendor/
public/
artison
server.php
If this was all dropped into a Public directory on the server, then you would have to access the application/website at the domain www.domain.com/public/
I am hoping there is a way to put all these files/folders into a public or www htdocs type folder and still access the application at the root.
I know the main reason to keep the PHP files out of the Public accessible folder is for security but in my clients situation this is not possible the way there server is configured.
Surely there is a way to do this?
Try putting contents of public in same directory as other folders, and then edit your index.php previously in public to look something like this
require __DIR__./bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php';
I haven't tried this. Just came to my mind right now
Anyway, I'm doing this by keeping app, boootstrap, vendor in / of my hosting, and contents of public are in my public_html. It works fine, and I guess it could be a security plus.