Writing permissions

Questions about how to install and problems installing - please read the documentation first!
Post Reply
kvalb
Posts: 11
Joined: Mon Jun 03, 2013 6:28 pm

Writing permissions

Post by kvalb » Sat Jun 21, 2014 6:11 pm

I've got a problem about writing permissions. I've uploaded the site via ftp and when I check the "Info" and "System check" in backend it shows all relevant files writeable. The green sign on all files.

But when I want to update a page the system says it can't write fx. to content-file.

The site is a CMSimple_XH 1.5.7 on a windows-server and it runs php 5.2. I can't change Chmod through ftp. The webhost says they have made all files writeable.

Could there be a problem with the paths?

I would have like to include som screenshots, but somehow I can't paste them.
Kim Valbjørn

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Writing permissions

Post by cmb » Sun Jun 22, 2014 11:03 am

On http://plaintec.dk/ there is a more basic problem than file permissions: one can't effectively log in (i.e. after login you see the admin menu, but on the next navigation the admin menu is gone). This is caused by the cookie path set to /index.php, where it should be /.

This is being caused by the domain http://plaintec.dk/ redirecting to http://plaintec.dk/Index.php. (Note the upper case I.) CMSimple_XH is supposed to deal with index.php, but not necessarily with Index.php.

Maybe you can fix that by changing cmsimple/cms.php line from

Code: Select all

define('CMSIMPLE_ROOT', str_replace('index.php', '', str_replace('/' . $sl . '/', "/", $sn))); //for absolute references
to

Code: Select all

define('CMSIMPLE_ROOT', str_ireplace('index.php', '', str_replace('/' . $sl . '/', "/", $sn))); //for absolute references
However, it might be best if the redirection to /Index.php will be fixed to /index.php. You may have to ask your provider to do so.[1]

PS: [1] Actually, the domain doesn't redirect, but CMSimple_XH does add the /Index.php after login. That is because SCRIPT_NAME is set to /Index.php. Have a look at the respective file. Is it stored as Index.php or index.php on the server. It should be all lower-case.
Last edited by cmb on Sun Jun 22, 2014 11:07 am, edited 1 time in total.
Reason: added PS
Christoph M. Becker – Plugins for CMSimple_XH

kvalb
Posts: 11
Joined: Mon Jun 03, 2013 6:28 pm

Re: Writing permissions

Post by kvalb » Sun Jun 22, 2014 3:36 pm

I tried the change in cms.php, but it didn't have any effect.

In the root, there is only the index.php from cmsimple, and no with a capital I.

I've tried to upload the site on an other (unix) server. I checked all the chmod was right, and I could write to the files. I downloaded the site and uploaded it on the web server again. And the fault is still there.

It must be something with it being on a windows server?
Kim Valbjørn

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Writing permissions

Post by cmb » Sun Jun 22, 2014 3:57 pm

kvalb wrote:I tried the change in cms.php, but it didn't have any effect.
Well, at least I can log in without manipulation the cookies. :)

However, it seems I cannot save anything. And indeed the behavior on this server is very strange, as the files are reported as writable by the system check (checked with PHP's is_writable()), but apparently they're not.

Please enable the debug mode (you have to rename XHdebug.txt to _XHdebug.txt via FTP; it doesn't work from the back-end). Maybe that gives some further insights what exactly is wrong.
Christoph M. Becker – Plugins for CMSimple_XH

kvalb
Posts: 11
Joined: Mon Jun 03, 2013 6:28 pm

Re: Writing permissions

Post by kvalb » Sun Jun 22, 2014 4:12 pm

I've enabled debug mode, but really don't know what to look for.
Kim Valbjørn

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Writing permissions

Post by cmb » Sun Jun 22, 2014 4:36 pm

kvalb wrote:I've enabled debug mode, but really don't know what to look for.
For instance, when you try to safe the content, you get the following information:
WARNING: fopen(./content/pagedata.php) [function.fopen]: failed to open stream: Permission denied
...\plugins\pluginloader\page_data\page_data_model.php:595
WARNING: fwrite(): supplied argument is not a valid stream resource
...\plugins\pluginloader\page_data\page_data_model.php:597
WARNING: fclose(): supplied argument is not a valid stream resource
...\plugins\pluginloader\page_data\page_data_model.php:599
This confirms the cause of the problem: ./content/pagedata.php is not writable.
kvalb wrote:The webhost says they have made all files writeable.
Apparently not. Maybe this web server needs Windows path separators (backslash instead of slash), but usually there are no problems with using slashes as path separator on Windows.

BTW: the line numbers in the PHP warnings above indicate, that there is something wrong with the line numbering. Apparently, each line ending (CRLF) is counted twice. Perhaps there are even duplicate line endings (CRLFCRLF or maybe LFLF) in the files? That might not be a problem, but it's better to fix it.
Christoph M. Becker – Plugins for CMSimple_XH

kvalb
Posts: 11
Joined: Mon Jun 03, 2013 6:28 pm

Re: Writing permissions

Post by kvalb » Sun Jun 22, 2014 6:04 pm

Hi' Christoph
So you think the problem is at the web server. And I can't do anything locally.

Thanks for your help
Kim Valbjørn

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Writing permissions

Post by cmb » Sun Jun 22, 2014 8:53 pm

kvalb wrote:So you think the problem is at the web server. And I can't do anything locally.
I suggest you try the following. Create a file test.php in your web root:

Code: Select all

<?php

$filename = '.' . DIRECTORY_SEPARATOR . 'test.txt';

if (is_writable($filename)) {
    if (file_put_contents($filename, 'foo')) {
        echo 'File written';
    } else {
        echo 'File couldn\'t be written';
    }
} else {
    echo 'File is not writable';
} 
Create an empty file test.txt in the same folder.

Request test.php: http://example.com/test.php (replace example.com with your domain name)

If your browser displays "File is not writable", ask your provider to make the file writable. If your browser displays "File couldn't be written", ask your provider to fix the broken setup. If your browser displays "File written", we have to consider to fix CMSimple_XH with regard to DIRECTORY_SEPARATOR.

PS: You may consider updating to CMSimple_XH 1.5.10, or better yet upgrading to CMSimple_XH 1.6.2, as the support for XH 1.5.x will end on June, 30th.
Last edited by cmb on Sun Jun 22, 2014 9:03 pm, edited 1 time in total.
Reason: added PS
Christoph M. Becker – Plugins for CMSimple_XH

kvalb
Posts: 11
Joined: Mon Jun 03, 2013 6:28 pm

Re: Writing permissions

Post by kvalb » Mon Jun 23, 2014 2:36 pm

I tried the test.php and it returned "File couldn't be written". I have already contacted the webhost with the problem, but haven't heard from them yet. The webhost is on Iceland and all communication have to go through a danish company.

And yes I will have to.upgrade.

Thanks
Kim Valbjørn

Post Reply