Hi,
I had installed zenphoto on IIS7 (Windows Server 2008) running PHP 5.2.9-1. The database server is MySql 5.1 (no transcational db). I successfully added rewrite rules by importing .htaccess. I endow all previleges to IUSR on 'albums', 'cache' and 'my_data' dir. Although I have 'PHP setlocale() failed' and 'PHP mbstring package Your internal characater set is ISO-8859-1', I think that's not a critical issue at all.
Albums could be successfully created and works perfectly as you can see
http://kpcstl.net:8080/zenphoto. An internal server error (500) occurs on some admin menus such as Backup/Restore, Publish contents and Reset thumbs. Interestingly, when I try to remove an album, it also causes HTTP 500 error. I think the problem is that it cannot delete directory itself but images files, even though the directory has full-previleged IUSR access. After the error, there is no file in the directory but directory itself remains.
Thanks,
Yong
Comments
The three admin menu items you mention are all located in the zp-core/utilities folder. Perhaps that folder has permission issues. As to the album folders, check to see if there are any hidden read-only files. They would prevent the folder from being removed.
Maybe also there are CGI errors which might shed some light on the problems.
The url again is : http://kpcstl.net:8080/zenphoto
I found the line causes 500 error on the scripts on zp-core/utilities folder.
$button_rights = ADMIN_RIGHTS;
Commenting those line, no error occurred.
Adding the line below in the zp-config.php and disable all rewrite rules on the zenphoto root folder, I found no difference but I can't use url rewrite.
$conf['mod_rewrite'] = false;
I created an album and uploaded images files. Before/after removing albums, I tried to find any hidden files in the album folder but I couldn't find anything but images I uploaded. I think the reason zenphoto cannot remove folder itself and causes 500 error is that after deleting image files, the process may not release the handle or need thread-sleep.
define('OFFSET_PATH', 3);
define('RECORD_SEPARATOR', ':****:');
define('TABLE_SEPARATOR', '::');
define('RESPOND_COUNTER', 1000);
chdir(dirname(dirname(__FILE__)));
require_once(dirname(dirname(__FILE__)).'/template-functions.php');
require_once(dirname(dirname(__FILE__)).'/admin-functions.php');
$button_text = gettext('Publish content');
$button_hint = gettext('Manage unpublished content in your gallery.');
$button_icon = 'images/calendar.png';
$button_rights = EDIT_RIGHTS;
The file removal code will release the handle. Also, if all the files in the folder have been removed it is unlikely that any thread-sleep is needed. However, this is from looking at the development stream code. Maybe you could try the nightly build and see if it has the problem.
I tested security issue by granting all privileges to those users and group. (my server name is SERVER)
- IUSR only: can create album/thumbnails, delete files | cannot delete folders
- IUSR_SERVER only: cannot create album, delete files and folders
- IIS_IUSRS only: can create album | cannot create thumbnails, delete files and folders
From this experiment, I found IUSR is the real internet guest user zenphoto is running as.
I tested another experiment. I tried to delete root album that has some sub albums with full-granted IUSR. The hierarchy looks like below:
test
- test2
- test3
I removed album "test".
It causes many permission warnings as below:
PHP Warning: rmdir(C:/inetpub/wwwroot/zenphoto/albums/test/test2/test3/) [function.rmdir]: Permission denied in C:\inetpub\wwwroot\zenphoto\zp-core\class-album.php on line 909 PHP Warning: unlink(C:/inetpub/wwwroot/zenphoto/albums/test/test2/test3) [function.unlink]: Permission denied in C:\inetpub\wwwroot\zenphoto\zp-core\class-album.php on line 899 PHP Warning: rmdir(C:/inetpub/wwwroot/zenphoto/albums/test/test2/) [function.rmdir]: Permission denied in C:\inetpub\wwwroot\zenphoto\zp-core\class-album.php on line 909 PHP Warning: unlink(C:/inetpub/wwwroot/zenphoto/albums/test/test2) [function.unlink]: Permission denied in C:\inetpub\wwwroot\zenphoto\zp-core\class-album.php on line 899 PHP Warning: rmdir(C:/inetpub/wwwroot/zenphoto/albums/test/) [function.rmdir]: Permission denied in C:\inetpub\wwwroot\zenphoto\zp-core\class-album.php on line 909
Also, regards the problem with the backup, etc scripts. The error caused by the placement of the buttons statement should at worst have been a warning. Most PHP configurations would not even have reported it. I suggest you check two things--one is the error reporting level, it should be E_ALL ^E_NOTICE. Second, check the configuratio of your error logs. The only way I can think of for an error message to cause a 500 error is if PHP could now write the error to the log.