Zend_Search_Lucene - 无法创建目录“/data/users_index”

发布于 2024-08-01 17:17:30 字数 445 浏览 4 评论 0原文

我在使用 Zend_Search_Lucene 创建索引时遇到问题。

现在,我的本地计算机上一切正常,所以我猜只是网络服务器上的文件权限存在问题。

以下是我尝试在控制器中创建索引的方法:

$index = Zend_Search_Lucene::create('/data/users_index');

当然,数据目录的权限设置为 0777。这是目录列表:

public_html
    public      0755
        css     0755
        js      0755
        data    0777

但我收到此错误:

无法创建目录“/data/users_index”。

I have a problem creating an index with Zend_Search_Lucene.

Now, everything works fine on my local machine so I guess there is just an issue with file permissions on the webserver.

Here is how I'm trying to create index in controller:

$index = Zend_Search_Lucene::create('/data/users_index');

Of course the data directory has permissions set to 0777. Here is the directory listing:

public_html
    public      0755
        css     0755
        js      0755
        data    0777

Yet I'm getting this error:

Can't create directory '/data/users_index'.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一梦等七年七年为一梦 2024-08-08 17:17:31

$index = Zend_Search_Lucene::create('public/data/users_index');

??

$index = Zend_Search_Lucene::create('public/data/users_index');

??

坏尐絯 2024-08-08 17:17:30

编辑/更新:在进一步阅读并查看您的结构后,我会尝试一下并尝试使用 ABSOLUTE 路径而不是相对路径以确保其写入写入位置。 抱歉我之前错过了那部分。 这显然不是最佳实践,但它至少会缩小是否是许可/发现问题的范围。

因此,将其更改为类似

$index = Zend_Search_Lucene::create('/path/to/public_html/public/data/users_index');

尽管,您确实应该将其放在公共 HTML 文件夹之外。 公众没有理由有权访问您的 Lucene 索引文件。

例如,我的存储在这里:

'../application/models/lucene/articles/index'

如果您使用的是 Linux/Unix 计算机,则必须 CHMOD 文件夹或 CHOWN/CHGRP 以便 Web 服务器具有写入权限。 如果您有权访问服务器,您可以简单地运行:

chmod -R 770 /path/to/your/data/users_index

但是,如果您不是服务器的管理员,您可能应该要求服务器管理员确保这是应用于此文件夹的正确权限,每个管理员都有他的权限/她自己对于如何设置文件夹权限的怪癖; 他们应该属于哪个组; 谁可以改变它; 如果您使用的是 Windows 计算机,则

必须右键单击该文件夹并向 IUSR_XXXXX 帐户授予权限,并授予他们对该文件夹的读/写访问权限。 (将 XXX 替换为您的机器名称)

Edit/Update: After further reading and seeing your structure, I'd give it a shot and try using an ABSOLUTE path rather than a relative to ensure its writing to the write location. Sorry I missed that portion earlier. It's obviously not the best practice, but it would atleast narrow down whether or not its a permission/finding issue.

So change it to something like

$index = Zend_Search_Lucene::create('/path/to/public_html/public/data/users_index');

Although, you really should put that outside of the public HTML folder. There's no reason that the public should have access to your Lucene Index Files.

For example, mine are stored here:

'../application/models/lucene/articles/index'

If you are on a Linux/Unix machine, you are going to have to CHMOD the folder or CHOWN/CHGRP so that the web server has write access. If you have access to the server, you could simply run:

chmod -R 770 /path/to/your/data/users_index

If you are not the admin of the server however, you should probably ask the server admin to make sure this is the proper permissions to be applied to this folder, every admin has his/her own quirks about how they want folder permissions setup; what group they should be in; who gets to change it; etc.

If you are on a Windows machine, you are going to have to right click on the folder and grant permissions to the IUSR_XXXXX account and give them read/write access to that folder. (Replace XXX with whatever your machines name is)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文