在HHVM中实施Kohana时拒绝许可

时间:2022-09-06 21:08:54

I am trying to implement Kohana framework within HHVM. The problem I am having is, im getting "Permission denied" exception from the below function under Kohana View class. (SYSPATH/classes/view.php). It is throwing exceptions while trying to include the template files. (include $kohana_view_filename;). In my case the file is /application/views/templates/default_page.php which has 777 permission. We are running apache2 on Ubuntu 14.04.1 LTS. Im not sure if the issue is with ubuntu or hhvm. Any idea how to sort it out ?

我正在尝试在HHVM中实现Kohana框架。我遇到的问题是,我从Kohana View类下面的函数获得“Permission denied”异常。 (SYSPATH /类/ view.php)。尝试包含模板文件时会抛出异常。 (包括$ kohana_view_filename;)。在我的情况下,该文件是/application/views/templates/default_page.php,具有777权限。我们在Ubuntu 14.04.1 LTS上运行apache2。我不确定问题是否与ubuntu或hhvm有关。知道怎么解决它吗?

protected static function capture($kohana_view_filename, array $kohana_view_data)
    {
            // Import the view variables to local namespace
            extract($kohana_view_data, EXTR_SKIP);

            if (View::$_global_data)
            {
                    // Import the global view variables to local namespace
                    extract(View::$_global_data, EXTR_SKIP);
            }

            // Capture the view output
            ob_start();

            try
            {
                    // Load the view within the current scope
                    include $kohana_view_filename;
            }
            catch (Exception $e)
            {
                    echo $kohana_view_filename.':'.$e->getMessage().'<br/>';

                    // Delete the output buffer
                    ob_end_clean();

                    // Re-throw the exception
                    throw $e;
            }

            // Get the captured output and close the buffer
            return ob_get_clean();
    }

1 个解决方案

#1


0  

Such message tells that PHP can't access file in filesystem tree.

这样的消息告诉PHP无法访问文件系统树中的文件。

Most likely you haven't provided required permissions to parent folder(s).

很可能您没有为父文件夹提供所需的权限。

For example:

例如:

  • you have file in /var/www/file.php and its permissions are 777: it's full access.
  • 你有/var/www/file.php中的文件,其权限是777:它是完全访问权限。
  • but /var/www/ folder itself has owner of root and 500 permissions: only root can only read folder contents and execute (change path to) it.
  • 但/ var / www /文件夹本身拥有root权限和500权限:只有root只能读取文件夹内容并执行(更改路径)。

So apache while accessig /var/www/file.php file under apache has to go to /, then to /var/, then to /var/www/, then open /var/www/file.php.

所以apache在apache下的accessig /var/www/file.php文件必须转到/,然后转到/ var /,然后转到/ var / www /,然后打开/var/www/file.php。

Because of unsufficent permissions on /var/www/ you're getting Permissions denied error.

由于/ var / www /上的权限不足,您将获得Permissions denied错误。

So make sure you have sufficent permissions in every parent folder. Good luck!

因此,请确保您在每个父文件夹中都具有足够的权限。祝你好运!

#1


0  

Such message tells that PHP can't access file in filesystem tree.

这样的消息告诉PHP无法访问文件系统树中的文件。

Most likely you haven't provided required permissions to parent folder(s).

很可能您没有为父文件夹提供所需的权限。

For example:

例如:

  • you have file in /var/www/file.php and its permissions are 777: it's full access.
  • 你有/var/www/file.php中的文件,其权限是777:它是完全访问权限。
  • but /var/www/ folder itself has owner of root and 500 permissions: only root can only read folder contents and execute (change path to) it.
  • 但/ var / www /文件夹本身拥有root权限和500权限:只有root只能读取文件夹内容并执行(更改路径)。

So apache while accessig /var/www/file.php file under apache has to go to /, then to /var/, then to /var/www/, then open /var/www/file.php.

所以apache在apache下的accessig /var/www/file.php文件必须转到/,然后转到/ var /,然后转到/ var / www /,然后打开/var/www/file.php。

Because of unsufficent permissions on /var/www/ you're getting Permissions denied error.

由于/ var / www /上的权限不足,您将获得Permissions denied错误。

So make sure you have sufficent permissions in every parent folder. Good luck!

因此,请确保您在每个父文件夹中都具有足够的权限。祝你好运!