Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP - Warning - 3rdparty HTMLpurifier #666

Closed
solarus0 opened this issue Apr 24, 2014 · 6 comments
Closed

PHP - Warning - 3rdparty HTMLpurifier #666

solarus0 opened this issue Apr 24, 2014 · 6 comments

Comments

@solarus0
Copy link

I've just reboot my Apache2 server, and since that I can't access to wallabag, I get a blank page with a code HTTP 200.

In the Apache error log's - I got thousands of this error..

[Thu Apr 24 15:46:56 2014] [error] [client xxx.xxx.xxx.xxx] PHP Warning: readdir() expects parameter 1 to be resour
ce, boolean given in /var/www/ultrawaves/wallabag/inc/3rdparty/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer
.php on line 122

Thanks for your help.

@solarus0
Copy link
Author

Here is the code concerned by the error.

public function flush($config)
    {
        if (!$this->_prepareDir($config)) {
            return false;
        }
        $dir = $this->generateDirectoryPath($config);
        $dh = opendir($dir);
        while (false !== ($filename = readdir($dh))) {
            if (empty($filename)) {
                continue;
            }
            if ($filename[0] === '.') {
                continue;
            }
            unlink($dir . '/' . $filename);
        }

@solarus0
Copy link
Author

The first problem disapeared but now I got this new one.

[Thu Apr 24 19:07:28 2014] [error] [client xxx] PHP Warning: require_once(inc/poche/global.inc.php): failed to open stream: Permission denied in /var/www/ultrawaves/wallabag/index.php on line 13, referer: https://ultrawaves.fr/wallabag/
[Thu Apr 24 19:07:28 2014] [error] [client 2a01:6600:8080:5600:2c23:f123:bb54:9994] PHP Fatal error: require_once(): Failed opening required 'inc/poche/global.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/ultrawaves/wallabag/index.php on line 13, ref
erer: https://ultrawaves.fr/wallabag/

I set the folder permission to 700 and now it's working, but with a 600 it doesn't.
Is it normal that the wallabag folder requires execution (x) permission ?
What permission set do you prefer ?

@tcitworld
Copy link
Member

It's only the inc/ folder which needs a chmod 755, like the db/ and the cache/ folders.
Others do not require write access, exception for assets if you choose the option and for vendor package when installing.

@mariroz
Copy link
Contributor

mariroz commented Apr 24, 2014

@solarus0, just read a bit more about file/folder permissions in linux: execute bit means "able to view", "search" for folder. So, pls don't experiment with permissions, if possible.
If you run wallabag under Apache with mod_php, pls make sure, that ALL forders are "executeable" for web user (owner of Apache child processes), plus folders assets, cache and db (in case your storage is sqlite) should be writable for the same user.

@solarus0
Copy link
Author

Ok I'm sorry.
So, assuming the owner is www-data,you recommend to use chmod 700 on all folders ?

I "experimented" permissions, in order to find what needed to be executable.
My wallabag works with these rights.

chmod -R 400 *
chmod -R 700 inc/ cache/ db/ vendor/
chmod -R 500 themes/

It's not a bug so I close this issue
Thanks a lot for your help.

@mariroz
Copy link
Contributor

mariroz commented Apr 24, 2014

@solarus0, good explanation about directory permissions you can find for example here http://unix.stackexchange.com/questions/21251/why-do-directories-need-the-executable-x-permission-to-be-opened .
According to wikipedia (http://en.m.wikipedia.org/wiki/File_system_permissions): " the effect of setting the permissions on a directory (rather than a file) is "one of the most frequently misunderstood file permission issues". So, you are not alone :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants