Change Laravel storage path to outside of instalation directory - php

I have installed Laravel on /var/www/html/website but now I want to change storage path to /mnt/volume
So for doing this, I added this code in bootstrap/app.php
app()->useStoragePath('/mnt/volume/public/');
Now upload works fine, but after upload, a file new extra directory created like:
/mnt/volume/public/mnt/volume/mnt/volume/public/bookimages/77iF2Gdr7pKXXLRLovgIpfcKBxY1h7CRqKjc35SC.jpeg
which as you can see Laravel created mnt/volume/mnt/volume directory again.
Laravel Framework 5.5.44
Now, How can I solve this issue?

Create a custom disk in your filesystem.php config file with the root property set to your custom path instead

Related

Cloned laravel project Dropzone storage link

I have set Laravel dropzone and it's working on my project.
I have cloned that project and trying to modify things but when I'm trying to upload files it's working and they are in the storage but when I want to see my files that I have uploaded I get
404
Sorry, the page you are looking for could not be found. error
This is my link when I click on the document
I'm using Laragon
EDIT:
I noticed that I have public >storage>storage
path:
public\storage\storage
And also a file named storage where I have a public file with an app file where inside I have another storage file
something like
path:
storage\app\public\storage\
Your link is looks like incorrect, http://mylocal.test/storage/storage/eOSuhkeabtKGuj4PRGePv0dxl8Fl0iQ3n7qLKvHs.pdf the storage path repeated on the url.
Can you try single storage path in the url?
http://mylocal.test/storage/eOSuhkeabtKGuj4PRGePv0dxl8Fl0iQ3n7qLKvHs.pdf
SOLUTION: when you clone your project delete public>storage and run
php artisan storage:link
to link it with your new path

How to upload laravel 5.5 project to cpanel in addon domain

This is Bablu Ahmed. I want to upload my laravel 5.5 project into cpanel and my domain is an addon domain name is w3public.com and it's root directory is not inside the public_html it is outside the public_html (www.w3public.com). I have separated the project's files into two directories, one is www.w3public.com and another is laravel and I moved public folder's files into www.w3public.com and all other files into the laravel folder in cpanel that is given in screenshot below. I have also modified the index.php file of www.w3public.com as follows:
require __DIR__.'/../../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../../laravel/bootstrap/app.php';
But it is not working. Can anyone help me with appropriate solutions?
Screenshot:
Your application should be installed in www.w3public.com and then change the root path from cpanel domains to the public folder inside laravel.
The best way to transfer files is git or the likes, but if they don't have it (usually is the case in shared hosting), you should use a ftp client, and if they don't allow that either, you can upload files/folders from cpanel (way too slow sadly).
If you use git be careful since by default vendor folder is in the .gitignore (you have to run "composer update --no-dev" after all the files are transferred)
Make sure also that your ".env" (usually in .gitignore too, so you prob have to make one) file have your server database info.

Laravel Storage:Link not working for custom folder structure

My Laravel folder structure is
Laravel
|
|--site
|--files
Here, sites is my public folder. And rest of the folders go to files folder.
Now, when I run the command php artisan storage:link, it says
System cannot find the path specified
And obviously, the link is not working.
What am I missing here?
you have to update your helper functions
public_path()
storage_path()
according you your new directory structure
don't change the core may be you can create a new helper file and include in the composer.json.

move laravel to live web

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:

create a direcory in pagodabox app

I am creating a pagodabox app in codeigniter , In this app i used uploads folder to store the images, now i need to create a sub-folder named "thumb" to save thumbnail of uploaded image.
my problem is that directory is not created on server. Any help is appreciated
Probably you need Pagodabox writable storage:
https://pagodabox.com/features/shared-writable-storage
As far I know, pagodabox uses git for source control, right? If so, why don't you just create new directory on your local repo and commit/push it? That should do the work fine. Also, pagodabox's hook file should help you set directory write permissions as well.
Git ignores empty directories (actually ignores folders in general).
Make the directory in your local repo, and create a file in it. You can delete this file later or add it in .gitignore.

Categories