Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.6.0
-
Component/s: Zend_Search_Lucene
-
Labels:None
-
Fix Version Priority:Must Have
Description
Hi,
When I try to re-create the index, I get this error. Let me know what to do? I'm using ZendFramework-1.0.3.
PHP Fatal error: Uncaught exception 'Zend_Search_Lucene_Exception' with message 'chmod(): Operation not permitted' in ~/Zend/Search/Lucene/Storage/Directory/Filesystem.php:189
Stack trace:
#0 /var/www/daedalus/htdocs/kishore/bioethics3/Zend/Search/Lucene.php(210): Zend_Search_Lucene_Storage_Directory_Filesystem->createFile('index.lock')
#1 Zend/Search/Lucene.php(171): Zend_Search_Lucene->__construct('/var/www/daedal...', true)
#2 createindex.php(16): Zend_Search_Lucene::create('/var/www/kishore/...')
#3 {main}
thrown in Zend/Search/Lucene/Storage/Directory/Filesystem.php on line 189
I actually wrote a php script to create index, which is being called by a cron file.
I will appreciate if someone gives me a solution.
Thanks,
Kishore
Issue Links
| This issue is duplicated by: | ||||
| ZF-2779 | chmod in Zend_Search_Lucene_Storage_Directory_Filesystem causes problems |
|
|
|
The problem is that it is using chmod() instead of umask(), which is probably a bad thing for a library to do. This is bad when the owner of the file is not the server user (e.g., publisher:apache or publisher:www) but you do not want to give the user (in this example, publisher) sudo rights so that it can change ownership to apache:apache.
What this should do is umask() in Zend_Search_Lucene_Storage_File_Filesystem prior to the fopen() call (which is passed w+b to create the file if it does not exist). The umask should be 0111 (for the default of 0666):
The call to chmod() should be removed, or at least there should be a call to fileperms() first to see if the permissions are correct. By correct, I mean between 0660 and 0777. I'm not sure why the default is 0666.