Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Issue with Views when using symbolic links
  • Hey,

    i use symbolic links in my current project to reduce duplicate code. (dont ask why)

    /var/www/vhosts/symlinks/app/views <- shared views
    /var/www/vhosts/example.com/app/views <- this path is linked to the path above

    The Issue

    if i try to use a view from a sub directory in /views for example /views/admin i got a 500er error and a "Error - The requested view could not be found: /admin/dashboard.html.twig"


    /var/www/vhosts/symlinks/app/views/admin/dashboard.html.twig exists

    thanks for any help
  • Northing wrong with that, we use symlinks to make theme files public.

    It is most likely that your webserver doesn't have the permission to read the files, you need to give specific config to allow symlinks to be followed (it is a security measure), and if you're on Redhat, it might also be selinux that is blocking access...
  • hm

    /var/www/vhosts/symlinks/app/views/dashboard.html.twig

    whould work

    thats why i wonder 

    it also works with 

    shared controllers, shared models and even my shared /assets 

    only with the views it doesnt work as "aspected" in the case there are sub dirs

    note: i use twig as template language


    can confirm that my admin/login works if i dont use this line

    return Response::forge(View::forge('admin/login.html.twig', isset($data) ? $data : array(), false));

  • I don't know, it's not a framework issue, it is a server issue.

    Create a test.php in your public directory, and do a file_get_contents() of your view file. Does that work?
  • hm

    i double checked group, owner and chmod of curse

    shared views does have same owner, group & chmod like the views but with the test script it works for all files in /app/classes but not in views

    shared config files in app/config work to

    i dont know why

    dirs have 0755
    files 0644
  • What OS? What webserver? Did you check if follow symlinks is enabled? Did you check if there is no SELinux or AppArmor blocking access?

    Did you create the test.php to check what the exact error is that you get when you try to read the file? Did you check what the webserver and/or PHP log file says?
  • No selinux or something Like that ...

    Yes Sure Test.php

    Again in only dies Not Work in App Views subdirs

    Have to Note that the subdirs in the Origin Projekt was created by PHP mkdir Trier with 0644 and 0755 nö luck
  • HarroHarro
    Accepted Answer
    What OS? What webserver? Did you check if follow symlinks is enabled?

    ...what the exact error is that you get when you try to read the file? Did you check what the webserver and/or PHP log file says?

    I can't really say much without so little information.

    If a "naked" file_get_contents() fails, it is either a permission issue or a configuration issue.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion