Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vainway 's avatar

storage not working on my Premium Shared Hosting

I had a single shared hosting at hostinger.com and made an upgrade to a premium shared hosting because I wasn't able to upload files or images on my laravel project, I tried different types like symlink and other functions, I removed symlink in disableFunctions and I have nothing right now, I had this problem on my single shared hosting posted on laracasts and still unsolved for now, I really need your help guys, I can't loose this host too.

0 likes
14 replies
Tray2's avatar

First of is your document root set to /public

Upload usually goes to you storage directory, with the symlink you link the storage directory into your public directory.

So if you upload and image check where it ends up in your storage directory and then check if you can get to it from your public directory. If you can't create a symlink in the public directory pointing to the directory of your uploads.

vainway 's avatar

@Tray2 thanks for that but that's not the problem, It works well on my local server 127.0.0.1:8000/ but doesn't work on my hosting server

my controller

public function portfolioAdd (request $request) 
    {
        $this->validate($request, [
            'img_title' => 'required|min:3',
            'slug' => 'required|file|max:2024',
        ]); 

        $upload = $request->file('slug');
        $path = $upload->store('public/storage/gallery');

        Gallery::create([
            'img_title' => $request->img_title,
            'slug' => $path,
            'user_id' => Auth::user()->id
        ]);

        return redirect('/portfolio')->with('success', 'Your data is successful Added');
    }

I even tried to change my filesystem but still the same error

this is my HTML file

<div class="container">
    <div class="row">
      <div class="portfolio-items">
        @foreach($portfolio as $portfolios)
        <div class="col-sm-12 col-md-6 col-lg-4">
          <div class="portfolio-item">
            <div class="hover-bg"> <a href="{{ Storage::url($portfolios->slug) }}" title="{{ $portfolios->img_title }}" data-lightbox-gallery="gallery1">
              <div class="hover-text">
                <h4>{{ $portfolios->img_title }}</h4>
              </div>
              <img src="{{ Storage::url($portfolios->slug) }}" class="img-responsive" alt="Project Title"> </a> </div>
          </div>
        </div>
        @endforeach
      </div>
    </div>
  </div>

when I try the symlink it creates this file but the file or storage it creates doesn't work

public -> /domains/mydomain.com/public_html/laravelpro/storage/app/public

my routes

Route::get('/gallery', 'GalleryController@index');

how I create my symlink

Route::get('/cache', function() {
    Artisan::call('cache:clear');
});

Route::get('/storage', function() {
    Artisan::call('storage:link');
});
Tray2's avatar

@niyo Are you using apache? Make sure the follow symlinks is enabled and that apache has permissions to the directories

vainway 's avatar

@Tray2 I am using Hostinger.com premium hosting but in my Hpanel, I don't see where I can find apache

disableFunctions

system, exec,  mysql_list_dbs, ini_alter, dl, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail 
I remove symlink in disableFunctions

I create a post and am able to view it in my public folder but not on the website

public/storage/gallery/7qOOOcbezcVUIxgdQ55feOUgokcE3jQieQ2QrnyR.jpg

I told you that It works well on my local server and the way I call them in the HTML have no problem, It just started when I hosted the website

jlrdw's avatar

@niyo How ro articles will explain how to setup things. Like this article from Digital Ocean:

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-laravel-with-lemp-on-ubuntu-18-04

See if your host has any tips, blogs, tutorials or help on how to get everything setup. I have used Godaddy but never used hostinger.com.

But you should be able to setup all similar to development, make sure the symbolic link works.

Edit

You didn't see this article: https://www.hostinger.com/tutorials/how-to-install-laravel-on-ubuntu-18-04-with-apache-and-php/

vainway 's avatar

@jlrdw thank man but my question is should I install apache first before I upload my project on the server. I even thought that apache comes with PHP itself because I start apache with Msql every time on my xampp

jlrdw's avatar

@niyo You could. But remember I am not familiar with your host so if you have more questions contact their technical support.

But you should be able to set everything up once you have Apache, php and mysql.

siangboon's avatar

i probably would: check the log for more hints... write a simple "write/upload file" function in the web.php file to the path that i want to make sure the upload or write permission to that path is workable.

Please or to participate in this conversation.