Check the logs for Locale warnings

If you are running Linux and haven’t set your locale yet, FuelPHP may be running with the default en_US and silently logging a warning if your system doesn’t support the locale. Often, Linux systems have the locale “en_US.utf8” instead, but you can determine what is available with a “locale -a”.

The logs located in fuel/app/(year)/(month)/(date) will tell you if there are any warnings. You can run a “php oil help” from the console to generate an entry in the log file if there is a problem with the set locale.

Harro Verton, thanks for the tip on determining existing locales and on using en_US.utf8.


FuelPHP 1.5.1: Fatal error: Call to a member function log()

I installed FuelPHP v1.5.1 earlier today with a manual installation (i.e. extraction) rather than with the oil command-line utility. As I tried to access the website in a browser, I got the following error message:

Fatal error: Call to a member function log() on a non-object in /var/www/fuelphp-1.5.1/fuel/core/base.php on line 91

Now, this was a known bug so I looked up a workaround, which involved a couple of extra lines to the instance method of log.php. The change displayed yet another error message, which makes more sense:

Fatal error: Uncaught exception ‘Fuel\Core\PhpErrorException’ with message ‘mkdir(): Permission denied’ in /var/www/fuelphp-1.5.1/fuel/packages/log/classes/log.php:56 Stack trace: #0 /var/www/fuelphp-1.5.1/fuel/core/bootstrap.php(48): Fuel\Core\Error::error_handler(2, ‘mkdir(): Permis…’, ‘/var/www/fuelph…’, 56) #1 [internal function]: {closure}(2, ‘mkdir(): Permis…’, ‘/var/www/fuelph…’, 56, Array) #2 /var/www/fuelphp-1.5.1/fuel/packages/log/classes/log.php(56): mkdir(‘/var/www/fuelph…’, 511, true) #3 /var/www/fuelphp-1.5.1/fuel/packages/log/classes/log.php(83): Log\Log::_init() #4 /var/www/fuelphp-1.5.1/fuel/core/base.php(91): Log\Log::instance() #5 /var/www/fuelphp-1.5.1/fuel/core/classes/error.php(27): logger(400, ‘2 – mkdir(): Pe…’) #6 /var/www/fuelphp-1.5.1/fuel/core/classes/error.php(110): Fuel\Core\PhpErrorException->handle() #7 /var/www/fuelphp-1.5.1/fuel/core/bootstrap.php(42): Fuel\Core\Error::exception_handler(Object(Fuel\Core\PhpErrorException)) #8 [internal function]: {closure}(Object(Fuel\Core\Php in /var/www/fuelphp-1.5.1/fuel/packages/log/classes/log.php on line 56

This pointed me to the source of the error, which boils down to filesystem permissions. As a part of the manual installation process, I had to provide write access to the tmp, cache, log, and config directories within the fuel/app directory – a step that apparently slipped my mind. Oh well, at least I was able to point the other folk on the project to the source of an error that had its own ticket.