ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

NearlyFreeSpeech and writing to template directory

February 10, 2012 2:13pm

Subscribe [2]
  • #1 / Feb 10, 2012 2:13pm

    OrganizedFellow

    435 posts

    I’ve been with my new host NearlyFreeSpeech.net for a few months now.
    I am able to edit a template file in the control panel. But I am not able to save the file itself.
    A quick search here on the forums revealed these two similar threads (search term = NearlyFreeSpeech):
    PHP Fast Mode…
    Template changes to file are not seen by EE until templates are synced

    I KNOW IT’S NOT AN ISSUE WITH EE, that is not why I am posting.
    I’m posting because I found an in-depth explanation about writing files in php on their blog.
    I also found the two main steps to follow to set up successful file writing in their FAQ.

    Set the parent directory you will be writing files in to group web with 775 permissions.
    Set the top-level PHP script doing the writing to group web with 644 permissions.

    I know that I don’t have the necessary permissions to change the ownership of the directory nor script, as described above. I’ll have to submit a ticket to NFS staff.

    Here is what my site looks like:
    /public_html/mywebsite.com/mytemplates/default_site/this.group
    /public_html/mywebsite.com/mytemplates/default_site/that.group
    /public_html/mywebsite.com/index.php

    But my question for you all here is:
    Which parent directory?
    default_site?
    this.group & that.group?
    Which top-level PHP script?
    index.php?

    *******************************************
    EDIT: I’ve edited this post to insert this:
    v2.4.0 - Build: date 20120123

  • #2 / Feb 10, 2012 2:59pm

    OrganizedFellow

    435 posts

    I think the top-level PHP script doing the writing is “/system/index.php”, right?

  • #3 / Feb 10, 2012 4:27pm

    OrganizedFellow

    435 posts

    Installed cygwin with ssh thing.
    Found a short tutorial on connecting to site with ssh.
    SUCCESS!
    😊

    I was able to navigate the directories of my site and locate the directory and file/script that I suspected was trying to create the file.
    I also successfully changed the ownership of the directory and file.

    I even went so far as to change ownership of the parent of the parent: this.group, that.group, default_site, and mytemplates.

    I changed ownership of the site root index.php file and also the admin control panel index.php file (I don’t know which one I am supposed to change).

    After varying combinations of files and folders, I reverted everything back to original state because I still can’t save to the text file.


    Today I’ve learned to use SSH to work on my site.
    Hopefully later I’ll learn which files/folders I need to change ownership.
    😊

  • #4 / Feb 11, 2012 9:40pm

    OrganizedFellow

    435 posts

    ?
    any help?

  • #5 / Feb 11, 2012 10:22pm

    Dan Decker

    7338 posts

    Hi OrganizedFellow,

    Thanks for all your research! This question comes up quite a lot. Not especially for NFS hosting, but permissions overall.

    To answer your questions, /system/expressionengine/templates/ is the parent directory. ExpressionEngine will need to be able to create default_site and .group folders. Also, any other “site_short_name” folders in the event that you would ever use MSM. Second, you are correct on your second guess, /system/index.php would be the script writing the files.

    Cheers!

  • #6 / Feb 12, 2012 2:14pm

    OrganizedFellow

    435 posts

    Hi Dan.

    Thanks for the reply 😊

    Basepath to Template File Directory is not here:
    /public_html/mywebsite.com/system/templates/
    I like having them outside my /system/ directory, so I’ve put them here:
    /public_html/mywebsite.com/mytemplates/

    So just to be certain, because I did what I thought I was supposed to do, but it didn’t work.

    Set the parent directory you will be writing files in to group web with 775 permissions.
    Set the top-level PHP script doing the writing to group web with 644 permissions.

    The parent directory is: /public_html/mywebsite.com/mytemplates/
    I think the top-level PHP script doing the writing is “/system/index.php”, right?

    That didn’t work, so I went further and set
    /public_html/mywebsite.com/mytemplates/default_site
    That still hasn’t worked.

    ————————————————————————————————————-
    It’s not critical that I have write permissions set on those folders, as I do all of my template work on a duplicate installation on my localhost. Then I FTP them up.

    I’m just a bit of a perfectionist and want everything setup properly.
    I’m sure some time in the future I won’t be at my dektop to make some needed changes and just want the flexibility to edit via the control panel.

  • #7 / Feb 13, 2012 2:41pm

    OrganizedFellow

    435 posts

    This is the only error message I get:
    Unable to save your template as a text file

    This pops down from the top of the page. No other errors are displayed.

    I edited my original post to show the build and version number of my installation.

  • #8 / Feb 14, 2012 11:14am

    Shane Eckert

    7174 posts

    Hello OrganizedFellow,

    So we are down to just one error. This is the error we often see with safe_mode enabled. That is why we ask that safe_mode or “PHP Fast Mode” be disabled.

    Here are a few things you can try, but I think you have already touched on these.

    Can you verify that the “Basepath to Template File Directory” is correct in:  CP Home ›  Template Manager ›  Global Template Preferences

    Also, please double check your file permissions as this will often prevent you from saving template files to a directory.

    Are you able to talk with your hosting provider’s tech support about this? If they can help you get this to work, would you be open to updating this thread with the details?

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases