Fork me on GitHub

Fusebox

PHP Specific FAQ

Why do I get the error message "Could not get exclusive lock to application data file"?

Fusebox 4 needs to be able to create a 'compiled' file (which is based on what you put into fusebox.xml and all of your circuit.xml files) the first time the application is accessed (as well as anytime you change any of the XML config files). Fusebox tries to write this parsed application data file into the /parsed directory at the root level of your Fusebox application. When it (the web server) cannot write this file, then the error above is raised.
To solve the problem you will need to create a directory named parsed at the same level as the Fusebox Core Files and set the permissions on this folder to 777. Often this can be done with an FTP client or from your web hosting control panel.

If you're developing on Windows chances are you won't see this error until you try to deploy it to a Unix web server, since permissions are handled differently on Windows.

What is fusebox.init and why is it in the Sample App but not in the CoreFiles? Is it required?

The fusebox.init file was added in Fusebox 4.1. It is a "globals" file. It is included on every request, if it exists. It runs after the attributes are loaded, but before any fuseactions are run so you can do neat things with it like run security and change attributes.fuseaction for login. It's also a handy place to put your db settings. It's not "required" to run Fusebox, but it is part of the "official core." Note that the fusebox.init file replaces the need for using the old Globals plugin (although you can still use that w/ fusebox 4+ if you care to).

My fusebox.init.php files generally start of life like this:

<?php
         $self = 'index.php';
         $myself = $self . '?' .
         $application['fusebox']['fuseactionVariable'] . '=';
?>

Since $self and $myself are not built in variables, but they're widely used, this is a useful place to put them.