super3 / peercoin_website_old

Deprecated.
http://peercoin.net
MIT License
7 stars 46 forks source link

Locale System causing blank page? #246

Closed danbartram closed 10 years ago

danbartram commented 10 years ago

Trying to find the cause of the blank page issued brought in with Pull #242.

danbartram commented 10 years ago

Thank you for the SSH access, this is what I've done so far:

cd /site/dir

# Check out my locale commit
git checkout 4e135f9 .

I reloaded the peercoin.net site and I got the white page error that I couldn't reproduce on my end.

# Undo my changes
git reset HEAD .
git checkout -- .

So I went to check the Apache logs and found this:

[Tue Feb 25 14:54:31 2014] [error] [client 46.28.53.170] PHP Fatal error:  Cannot redeclare class Locale in /var/www/locale/locale.php on line 4

This is the file causing the fatal error and thus a blank page: https://github.com/super3/peercoin.net/blob/4e135f94db9bef8e061c690d1bc365ae5fcd2c9f/locale/locale.php#L4

For some reason the Locale class is being declared twice.

This is still occuring when I modify index.php:2 to include_once() instead of include().

I'll keep looking into it, but I thought I'd share what I've found/tried so far.

danbartram commented 10 years ago

Aha!

I think I've figured it out!

Your server is running with an already enabled Locale class - class.locale.php docs.

We can either find a way to turn that off, or I resubmit a push with a different class name instead of Locale. Any preferences?


Beautiful! The site is now live and working with my locale commit.

What I Changed

Modify the PHP INI settings to disable the international locale system.

cd /etc/php5/mods-available/

# Modify the international settings
nano intl.ini

Comment the extension line so it does not get enabled/used.

Old

; configuration for php Internationalisation module
; priority=20
extension=intl.so

New

; configuration for php Internationalisation module
; priority=20
;extension=intl.so

Reload Apache and everything works fine.

service apache2 reload

It's not the best solution, and could have issues that I haven't noticed yet, but it's a possible workaround.

I think it'd be best to re-enable the intl PHP module and rename my class to something else, rather than disabling something we don't really know if we need or not.

Documentation for intl module

http://uk1.php.net/manual/en/intro.intl.php

Internationalization extension (further is referred as Intl) is a wrapper for » ICU library, enabling PHP programmers to perform » UCA-conformant collation and date/time/number/currency formatting in their scripts.

Do you think that module is needed on the server? I just don't like disabling something if I don't totally know what it's meant to do. I don't believe this module is needed on the server, but you may disagree.

super3 commented 10 years ago

I have no opinion on that matter. If it works, it works. Please add a note to the root README, so it can be recreated if I ever need to restore the Peercoin.net site from a blank server.

Added you to the collab list for the repo. I've reverted my revert, so your changes are now on the current version. (Note: the site updates every 10 minutes from the current master).

danbartram commented 10 years ago

Thanks for the push access, I'll keep the work around as the current "working system" and if we need to make use of that intl module in the future, we'll rename our Locale class to something else like Translator or Localizer.