Hi.
I'm having problems trying to download and install new themes and modules.
The Modules and Themes directories both have correct access rights (0770).
When trying to install I get the following error
Quote:
Error (ERROR_PLATFORM_FAILURE) : Couldn't create directory [/usr/home/web/album/themes/fluid/] in modules/core/classes/GalleryRepository.class at line 601 (GalleryCoreApi::error)
in modules/core/classes/GalleryRepository.class at line 663 (GalleryRepository::downloadAndUnpack)
in modules/core/classes/AdminRepositoryDownloadAndInstallController.class at line 93 (GalleryRepository::downloadPackagesForPlugin)
in ??? at line 0 (AdminRepositoryDownloadAndInstallController::performDownloadAndInstallation)
in modules/core/classes/GalleryTemplateAdapter.class at line 1092
in g2data/smarty/templates_c/%%301620551/lofblom/%%C3^C3C^C3C22032%%theme.tpl.php at line 112 (GalleryTemplateAdapter::trailer)
in lib/smarty/Smarty.class.php at line 1255
in modules/core/classes/GallerySmarty.class at line 61 (Smarty::fetch)
in modules/core/classes/GalleryTemplate.class at line 241 (GallerySmarty::fetch)
in main.php at line 506 (GalleryTemplate::display)
in main.php at line 104
in main.php at line 88
After some debugging I found out that the problem is method "mkdir()" in GalleryPlatform.class. It seems the PHP can't create the directory if the $path string includes a trailing slash. Not sure if this is unique to my host or not, because I think this has worked before without any problems.
What I did to fix this was to add an Regexp to the function call to PHP's "mkdir()" function that removes trailing slashes.
Quote:
// $results = mkdir($path, $octalPerms);
$results = mkdir(preg_replace('/\/$/', '', $path), $octalPerms);
BR
Emil
Posts: 16503
This works on almost all other platforms, so I doubt it's much of a bug otherwise we've have heard about this by now. Since this doesn't sound like a major security issue not much will be done about it since G2 is no longer in active development and all new development efforts are currently focused on G3.
But for reference and so we have it documented could you post your system information? What OS you're using, web server, version of Gallery, version of PHP, etc? I think most of that can be gathered from Site Admin > Maintenance > System Info.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 8
I tried to add new albums and that works without any problems, perhaps the $path string is sent without the trailing slash in that situation.
Here's the systeminfo:
Posts: 8
Hi.
Did some searches on internet and I think I found out what caused this.
It's a combination between Safe Mode Enabled and PHP version.
Safe Mode has always been enabled on my host. Before I didn't have this problem, but it was when my host upgraded the PHP version it started.
So there are three ways to fix the problem:
1. Remove the trailing slash from the script code
2. Downgrade to < PHP 5.1.6
3. Turn safe mode off
I had to go with option 1, since I'm not authorized to change the other two.
Perhaps you should have this in mind, remove the trailing slash, when developing Gallery3 to make it more compatible with different platform configuration.
BR
Emil
Posts: 16503
No official or officially supported version of Gallery has ever ran under safe_mode, nor will safe_mode ever be supported. Safe_mode is a 100% flawed system/hack and the PHP devs have finally come to that realization. It's being removed from future versions of PHP. Secure the system properly, not through hacks like safe_mode. If they allow ANY other language on their servers, python, perl, cgi, etc every single "security" feature of safe_mode has just been bypassed.
We will not spend any time troubleshooting any systems or problems crippled by safe_mode.
If your host is relying on safe_mode to "secure" their system, they are living under a false sense of security.
So, no this isn't a bug or a problem with Gallery. It's a problem with hosts who rely on bad practices.
See the warning here:
http://php.net/manual/en/features.safe-mode.php
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here