Gallery3:FAQ - Gallery Codex
Personal tools


From Gallery Codex

Revision as of 10:05, 11 January 2010 by Valiant (Talk | contribs) (Why do you use PHP's short open tags?)


I get an error 500 when I visit my Gallery 3 install for the first time

This probably means that your webserver doesn't support the "php_flag" command in the .htaccess file provided with Gallery 3. Solutions are:

  1. edit your php.ini file and set "short_open_tag" to 1
  2. edit your apache configuration file to allow per-directory overriding of Options or All (note that this has implications to broad to discuss here):
<Location "/gallery3/">
AllowOverride +Options

I get the welcome screen but the tabs don't work


  1. edit your php.ini file and set "short_open_tag" to 1

Strange things just don't seem to work

Perhaps you are using Gentoo? You may need to add the following USE flags and recompile PHP to make this work: filter, json, simplexml, tokenizer, ctype

I just svn updated and see a "Framework Error"

We likely changed something that broke something! (This won't happen once Gallery 3.0 is out) For now, you'll need to reinstall by axing your /var directory and starting over.

Are my photos secure? They're right there on my website!

In Gallery 2 we recommended that your images should NOT be in the document-root. But in Gallery 3, the default location is in "gallery3/var/albums" which is freely available on your website. So this means that your photos aren't secure, right?

Wrong! You have full photo security and with Gallery 3 you also get super fast performance. Any photos that are visible to all users are unprotected. But once you mark a photo as hidden to guests, we drop a special .htaccess file in with your photos that locks it down like Fort Knox. This approach makes Gallery 3 faster and lighter without sacrificing security. Pretty cool, huh?

GraphicsMagick or ImageMagick are installed but I can't select them. What do I do?

They are probably installed in a path that Gallery 3 doesn't know about (for example, fink on OS X installs things in /sw/bin). To fix this, either add the path to the folder containing your toolkit to your system PATH variable or modify files where PATH is coded into Gallery 3. Currently:

modules/gallery/helpers/graphics.php:   putenv("PATH=" . getenv("PATH") . ":/usr/local/bin:/opt/local/bin:/opt/bin:/sw/bin");
modules/gallery/helpers/movie.php:      putenv("PATH=" . getenv("PATH") . ":/usr/local/bin:/opt/local/bin:/opt/bin:/sw/bin");


What about feature X? It's really important to me!

Out of the box, Gallery 3 is not all things to all users. But never fear! We've created a module API so that crafty developers can add their own features to it. And they've added a bunch. Learn how to download and install new modules


How do I add the Development module

The module is in the gallery3-contrib repository. One way is to use git clone to have that repository beside my gallery3 repository. For example, have the Gallery 3 installation in ~/home/public_html/gallery3 and the contrib repository in ~/home/public_html/gallery3-contrib Now in gallery3/modules create a symlink "ln -s ../../gallery3-contrib/modules/developer developer". Now edit gallery3/.git/info/exclude and add the line "modules/developer", which tells the gallery3 git repository to ignore the modules/developer directory. Now install the developer module just like any other module.

How do I see debug information?

By default, Gallery 3 ships in production mode. This means that if something goes horribly wrong, we don't show it on your site since that can leak confidential information about your site works. There are two main places where you can look to find out what's going wrong:

  1. gallery3/var/logs contains a set of log files where Gallery 3 dumps out debug information when it detects that something went wrong
  2. your Apache 2 log files. The location for these files varies, but often times it's in /var/logs. If you can't find this file, please contact your system administrator

You can also take Gallery 3 out of production mode so that you see error messages directly in your browser. The easy way to do this is to create a file in your gallery3 directory called local.php containing these lines:

<? defined("SYSPATH") or die("No direct script access");
ini_set('display_errors', true);

After creating this file, try your operation again and you may see the actual error appear in your browser. Remember to delete or rename this file when you're done! It's not a huge security leak, but there's no point in showing application errors to your users.

Why doesn't Gallery 3 use the Smarty template engine?

Why did you choose Kohana?

We evaluated many PHP frameworks:

We even evaluated one non-PHP framework: Django:

Our evaluation criteria:

Some discussion about why use a framework at all as opposed to a home grown one:

Ultimately our decision was Kohana:

Why do you use PHP's short open tags?

Short open tags are considered harmful by some, but they result in much tighter syntax in our PHP based templates. Here are some possible ways to print 'Hello World' in different template systems:

   PHP long tags: <?php echo $Hello_World ?>
  php short tags: <?= $Hello_World ?>
             ASP: {% $Hello_World %}
          Django: {{Hello_World}}
          Smarty: {Hello_World} 

As you can see, PHP with long tags is the noisiest. The main reason for deprecating short tags is because the <? token conflicts with XML tags. In our case, this is highly unlikely to ever be a problem, and even if it is it's a vanishingly small edge case. We're optimizing for a good developer experience here by requiring them to type less to do more. If at some point PHP short tags goes away, we can pretty easily convert the entire app over to using long tags.

Short Open Tags and PHP 6

Short open tags will still be enabled by default in PHP 6. While there was initially an idea to change this in PHP 6, plans have changed and short open tags are here to stay.


Why am I seeing errors about suhosin.session.encrypt?

Suhosin is a modification to PHP that adds extra security. Unfortunately, sometimes this security is a little bit overboard and interferes with features. Flash based uploaders which rely on sharing a session with your browser can't operate with certain Suhosin settings so you may see this error:

   Error: your server is configured to use the suhosin.session.encrypt setting from Suhosin. You must disable this setting to upload photos.

You have to fix this by changing your PHP configuration either for all of PHP, or just for your Gallery3 install. If you want to change it site-wide, you can edit php.ini and put the following and restart Apache

 suhosin.session.encrypt = Off 

If you want to make this change just for a specific virtual host or directory, you can edit your Apache config file or .htaccess file and add this line in the appropriate virtual host block:

 php_flag suhosin.session.encrypt Off

Why am I seeing "Error 406"

mod_security is good to protect your website but it might cause some problems for certain web applications, especially in file uploads.

Add to your .htaccess file this line:

 SecFilterEngine Off

Why do I get a Error #2038 when I try to upload more than one item

Some servers have simultaneous upload limitations.
To overcome this; login, Click admin -> settings -> advanced
Change the gallery simultaneous_upload_limit to 1 and save.

Why am I seeing a blank, or partially blank page?

There's probably an unexpected PHP error in the script that's not getting shown in the browser because we don't show inexplicable and confusing errors to end users. Try examining the debug info to see if that turns up a clue.

How do I create a phpinfo page?

A phpinfo link is also very often needed. To create a phpinfo page on your server, do the following:

1. On your desktop, create a new text file
2. Open the text file and copy'n'paste the following:
 <?php phpinfo(); ?>
3. Save the text file and rename it to phpinfo.php (or any other file with the extension .php)
4. Upload the file to your gallery3 directory on the server


How do I upgrade?