Hello,
I've bumped into something I can't fix and understand myself...
I am trying to install Zen Photo Gallery on a server (Apache/php/mysql, standard stuff).
I downloaded and unpacked all files. I filled the data in the zp-config.php (database data). I then tried to load the install. Nope! Got the following error:
(First I tried to install Zen in a subdomain):
`Fatal error: Call to undefined function: mb_detect_encoding() in /home/XXXXXX/public_html/gallery/zp-core/lib-gettext/gettext.inc on line 101`
I tried to un-comment the lines:
`// define('WEBPATH', '/zenphoto');
// define('SERVERPATH', '/full/server/path/to/zenphoto');`
and specify the paths, but same error popped up.
I then thought, maybe problem is I try to install in a subdomain.
Tried a directory on a server (for example, I've created /photos), and got error:
`Fatal error: Call to undefined function: mb_detect_encoding() in /home/XXXXXX/public_html/photos/zp-core/lib-gettext/gettext.inc on line 101`
I can't do anything, I'm simply stuck...
What's this error, what does it mean and can I install Zen and how? :-)
Thanks for any help!! :-) It's very urgent, but I hope I can live till Monday:)
Cheers, Michel
Comments
I think I didn't find any mentioning of mbstring ...
What can I do, now?
// PS I tried to install latest stable release, 1.1.6
A possiblity would be to either define that function (just an empty one maybe) or comment out the part where it is required. I haven't tested that though.
As I have quite good experience in WordPress, and I did install WordPress blog on the same server several times, without problems, does this mean that either: 1) WP doesn't require mb_detect_encoding(), or 2) can be installed even if it's not there?
(To me ZP is a bit similat to WP, that's why I'm comparing them...)
Can't something be changed in the core of ZP so it can work without this, too? :-)
If not... What's the best way for me to proceed to install Zen Photo there?
1) I do not think I can change the php package/modules on the server...
2) So, if I must try to comment some lines in the gettext.inc file, then which ones exactly? (I am no php coder...) And what'll happen when a new version of Zen is released? I'll have to manually change them again and again, in that inc file, right?
Thanks for all the help!
Cheers, M.
1) Well, Zenphoto is not Wordpress but a certain similarity is indeed intended...:-) Wordpress has it's own modification of the gettext replacement libary (what you see in the zp-core/lib-gettext folder) so that most likely has a workaround for that. We plan to add a replacement like that later because this libary does not work at all as it is supposed to anyway, but we didn't manage that yet.
2) I did a quick search on the file, I have found two function calls that might cause trouble:
They are in gettext.inc line 101 and 104 in the function `_encode()`. Just comment out the whole function like this:
`/* function _encode($text) {
$source_encoding = mb_detect_encoding($text);
$target_encoding = _get_codeset();
if ($source_encoding != $target_encoding) {
return mb_convert_encoding($text, $target_encoding, $source_encoding);
}
else {
return $text;
}
} */`
At least on my installation that causes no error. Since these gettext lib is not really used, it should do no harm.
I'll try this workaround and will report back later if it fixed things for me
And, (on the sideline)... you know, I feel Zen Photo is very friendly little web app, with even friendlier developers & users around it! You should definitely become the new 'WP in organizing photos & albums' area of the web! I mean it! ))
Cheers, Michel
I got a new error:
`Fatal error: Call to undefined function: _encode() in /home/XXXXXX/public_html/gallery/zp-core/lib-gettext/gettext.inc on line 190`
Here's the part in the code:
`/**
* Lookup a message in the current domain.
*/
function _gettext($msgid) {
$l10n = _get_reader();
//return $l10n->translate($msgid);
return _encode($l10n->translate($msgid));
}`
so line 190 is: `return _encode($l10n->translate($msgid));`
Hm. Any ideas, how to continue...?...
OK, idea (for future versions):
If on the server the mbstring package is not activated or installed, can Zen detect this, and make parts of the code (via some 'if -- else' in PHP) related to it, not used?...
I am no PHP coder, but I guess that if php_info() can show if the package IS or is NOT there, if-else can be created and this part of the code made not used...
Hmmm?...
For now, I'd like just to see, if I can somehow (using /**/ comments) make so the Zen Photo to be installed on this server...
Thanks again!
--M.
I have tested it on my test environment with and without native gettext enabled, and my fellow devs did with native gettext, too, but we didn't get those errors.
You should be able to just comment out the function or just all the stuff within it. We currently experiment with that, too.
Thanks for the report.
Then, what I saw:
`Fatal error: Call to undefined function: gettext() in /home/bluelink/public_html/gallery/zp-core/functions.php on line 233`
So, another file which again references to that...
Hm. I can't comment code everywhere in all kinds of files, Zen'll then become too complicated and unstable for me, at the end... :-(
I think, currently, if mbstring package ain't there, I can't use Zen Photo... if this is the core culprit for my issues:-(
I'm happy I can contribute with a report of this bug:)
But I am not so happy I can't use Zen (at least, on this server). Any other ideas?... Or should I wait for a nightly build which might address that?... :-) How can I help more?
--M.
`function gettext($msgid) {
return _gettext($msgid);
}`
and change it to
`function gettext($msgid) {
return $msgid;
}`
This should provide the gettext function if not existing without having any effect. We tried that at least yesterday and are working on a workaround. But since we don't get those errors, it's hard to solve.
I deleted the modified by me gettext.inc file (as I have added too much comments into it;-), and replaced it with a new one (un-touched).
Then, the *only* change I made in it, is the once you recommended to me:
find:
`function gettext($msgid) {
return _gettext($msgid);
}`
and change it to:
`function gettext($msgid) {
return $msgid;
}`
After that, I tried to run setup again and here what I got:
`[Zen Photo Setup] Setup
Welcome to Zenphoto! This page will set up Zenphoto on your web server.
Systems Check:
pass: PHP version 4.4.6
pass: PHP Safe Mode
pass: PHP GD support
warn: PHP gettext() support [is not present]
Localization of Zenphoto currently requires native PHP gettext() support
[[ all other things: OK (pass) too, skipping some text here ]]
Go!
zenphoto version 1.1.6 [1550]`
So, I guess, if I click now the 'GO' button, Zen will be installed! :-)
Thanks a lot for the help!!
Suggestion: add some check; if `PHP gettext()` is not present, use if-else in the code (in gettext.inc?), to activate some sort of workaround (I changed part of the code, as you have advised me -- maybe this could be done automatically?) and so setup will be able to continue after producing this warning...
Hope that my feedback will be able to let you squash one more bug in ZP ))
Cheers, Michel
PS If anything else pops up, on this server, I'll notify you!
PPS For now, even this thread might help other people fix things for them, in case they have trouble with gettext(), too:)
A workaround will surely be in one of the next nightly builds.
Thanks again for reporting and testing. We are really dependend on that since we can't foresee all possible server configurations.
Glad I helped! :-)
Now going to set up tis new gallery :-)
--M.
With zenphoto 1.5 I didn`t have this problem.
Fatal error: Call to undefined function mb_detect_encoding() in /xxx/htdocs/zenphoto/zp-core/lib-gettext/gettext.inc on line 101
Now seriously, please try the nightly build.
Fatal error: Call to undefined function gettext() in /xxx/zenphoto/zp-core/functions-i18n.php on line 6
Fatal error: Call to undefined function gettext() in /xxx/htdocs/zenphoto/zp-core/setup.php on line 5