Elxis CMS Forum

Extensions => Templates => Topic started by: armpouniotis on December 13, 2012, 20:38:17

Title: Another Issue
Post by: armpouniotis on December 13, 2012, 20:38:17
Hi there !

ok, I am creating a template for Nautilus at my computer, I zip it and finally I upload it through the administration zone.

When I am changing something at my template, I am trying to upload again, using an FTP software, but I always get an error, that permission is denied.

I am always changing the permissions to 777 to all template files, but unfortunately, nothing happens.

So, my site still has the old template, and I can't upload the new files to the server.

How can I solve this ?

Thank you in advance
Christos

Title: Re: Another Issue
Post by: datahell on December 13, 2012, 22:19:59
This is not an Elxis issue but related to your server setup and file permissions.
We NEVER set files to 777! Usual php, css, js, html, jpg, png, etc..., files do not need to be executable. A file is public writeable if we set permissions to 666. Otherwise set permissions to 644. 644 is also the best option when suphp/suexec is used as apache runs in a jail cell as the local ftp user. If you run php as an apache module files owned by apache (nobody) needs to be chmod to 666 in order to become writeable by the ftp user. Also some FTP servers put restrictions on files if we chmod the parent folder to 777. Some FTP servers do not accept overwriting a file but they do accept deleting a file. In this case you delete the file and then upload the new version of it. There are too many different setups.

In all cases you can instruct Elxis to do whatever you want to a file/folder. Elxis docs has the related documentation on managing files (https://www.elxis.net/docs/developers/libraries/elxisfiles.html) for developers.

Some examples on using the elxisFiles library
chmod a file to 666
Code: [Select]
eFactory::getFiles()->chmod('templates/mytemp/index.php', 0666);
delete a file
Code: [Select]
eFactory::getFiles()->deleteFile('templates/mytemp/index.php');
delete a folder
Code: [Select]
eFactory::getFiles()->deleteFolder('templates/mytemp/');
Title: Re: Another Issue
Post by: armpouniotis on December 14, 2012, 00:13:33
Hi there !

when I am changing something to Aiolos or Delta template, then I am uploading it to the server using FTP software, and everything is fine. (Permissions are fine !)

but, when I am uploading a file to my template, then permissions are not permitted !!!

It looks also strange to me, but I can't do anything ! Not even when I am changing my template's permissions to 666 !
Title: Re: Another Issue
Post by: datahell on December 14, 2012, 10:02:20
Typical case, I think we have metnioned how to deal with such cases more than 100 times in this forum...

Files do not only have permissions, they also have owners. If you upload a file via ftp it will be write-able by the ftp user.
If you install an extension (eg. template) the files will be uploaded by the web server, so their user will be the web server (usually "nobody").
By default these files will have permissions 644. This permisisons allows only the owner of the file to modify them.
So if you go via ftp as user "vrasidas" you are not allowed to edit user's "nobody" files with permissions 644.
Title: Re: Another Issue
Post by: armpouniotis on December 14, 2012, 10:30:20
Thank you for your answer.

actually I found a solution to my problem.

I uploaded my template using FTP, and then I registered it in the Database manually... It worked in that way !

Christos