hexadog / laravel-themes-manager

Bring multi themes support to your Laravel application with a full-featured Themes Manager
https://laravel-themes-manager.netlify.app
MIT License
152 stars 31 forks source link

symlink(): Permission denied #75

Closed playazkah closed 11 months ago

playazkah commented 1 year ago

Why I get this error?

I'm using ISPCONFIG3 and apache2, I tried these steps:

php artisan storage:link chown -R web4:client0 /var/www/clients/client0/web4/web/* chown -R web4:client0 /var/www/clients/client0/web4/web/storage

sudo chmod -R 775 /var/www/clients/client0/web4/web/storage

But still getting that annoying symlink(): Permission denied error when this package trying to set the theme, I using your package in this way (getting the active theme value from database settings table active_theme key):

It's working on my local server but I want to deploy it on a remote server.

class HomeController extends Controller
{
    public function __construct()
    {
        $activeTheme = GeneralSettings::where('key', 'active_theme')->value('value');
        ThemesManager::set($activeTheme);
    }
}
gaetan-hexadog commented 1 year ago

Hi,

The package tries to link your theme public assets into the public/themes directory if it does not already exists.

The error seems to tell you that the user running the application on server is not allowed to create a symlink into the public folder of your application.

You can try to change the configuration flag symlink_relative to true to see if it fixes the issue.

playazkah commented 1 year ago

Hi,

changing the symlink_relative to true didn't fix the issue.

If I delete the theme and create it again with the php artisan theme:make command then it works but still can't use the {!! theme_asset('css/style.min.css') !!} helper

gaetan-hexadog commented 1 year ago

Can you check on your hosting if there is a folder named themes in the public folder of your laravel application and verify it contains a symlink to your theme ?

If not can you try to connect to your hosting via SSH and run the following command:

mkdir /var/www/clients/client0/web4/web/themes/THEME_VENDOR/
ln -S /var/www/clients/client0/web4/web/themes/THEME_VENDOR/THEME_NAME /var/www/clients/client0/web4/web/public/themes/THEME_VENDOR

Don't forget to replace THEME_VENDOR and THEME_NAME with your own.

playazkah commented 1 year ago

Yes, it is because I copied the my whole project folder from local to remote except the vendors.

Since that is my own VPS I can run the root commands, etc. I just ran composer update and composer install.

Now seems like everything works. But I had to delete the theme folder from public and from the project folder too. and re-install your package and then copy the theme files to the newly created theme folder.

So I think there is a problem with folder/file permissions but I can't figure out what I need to do lol

gaetan-hexadog commented 1 year ago

Glad to hear it works.

There is an issue with your folder/file permissions for sure. It should have happened when you copied your local files to your hosting.

github-actions[bot] commented 11 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.