Make your own free website on Tripod.com

C. Troubleshooting Gallery

C.1. When I try to access the configuration wizard, I get a 500 Internal Server Error. What's up?
C.2. I've installed Gallery and all seems well. But when I try to upload an image it says Unable to make thumbnail(0) or Invalid image. What gives?
C.3. My ISP has a really old version of PHP, something before 4.0.4pl1, which Gallery can't work with. What do I do?
C.4. Whenever I try to upload grayscale JPEG images I get a Unable to make thumbnail error. Why?
C.5. Whenever I try to upload an image in Gallery, I get all these errors about safe mode. How can I fix this?
C.6. Why can't I upload big files (over a megabyte or two)?
C.7. When I try to run configure.sh, I get an error like this: chmod: getting attributes of `setup\r': No such file or directory How do I fix that?
C.8. When I try to click on the "[login]" link on the Gallery page, nothing happens (no window pops up). What's wrong?
C.9. When I try to login, everything seems to go correctly, but Gallery doesn't log me in?
C.10. Why do I see Warning: Undefined variable: GALLERY_BASEDIR... at the top of the page?
C.11. I can successfully upload photos, but when I look in my album all I see are broken image icons. Why?
C.12. Why do I get Failed opening 'html_wrap/inline_albumthumb.header.default'
C.13. Why do I see this error: jpegtopnm: WRITING PPM FILE option `--quality' doesn't allow an argument?
C.14. Why, when I try to upload images, does it say No images uploaded ?
C.15. Why do I get this error: Warning: fopen(".../albums/team/album.dat.lock","a+")?
C.16. Why do I get the error Allowed memory size of Xxx bytes exhausted ?
C.17. Why do I get pnmtojpeg: No such file or directory when uploading images?
C.18. Why do I get this warning: Your script possibly relies on a session side-effect which existed until PHP 4.2.3?
C.19. Why, when I try to upload a .htaccess and chmod it with my FTP client, it "disappears"?
C.20. Why does uploading pictures on my RedHat 8.0 system result in an error or scewed picture?
C.21. Why doesn't Gallery work correctly on my RedHat 9.0 system?
C.22. How do I use Gallery both from inside my LAN and the internet?
C.23. I'm running Gallery 1.3.4, PHP 4.0.4 and I get Call to undefined function: array_search() in view_photo.php?
C.24. Why, when I edit an album or photo's text, do quotation marks appear as \' (e.g. John Doe\'s Album)?
C.25. I can't extract a .tar.gz file on my Windows machine. Why not?
C.26. Why do I get an EOF / read error reading magic number error when uploading pictures with NetPBM?
C.27. Why do I get errors like this: Warning: open_basedir restriction in effect. File is in wrong directory in /home/johndoe/public_html/gallery/platform/fs_unix.php on line 53?
C.28. Why do I get this error: Warning: write failed: No space left on device (28) in Unknown on line 0?
C.29. Why do I get this error: Warning: exec() has been disabled for security reasons?
C.30. Why can't I upload images using ImageMagick on FreeBSD?
C.31. How do I put my Gallery into debug mode?
C.1.

When I try to access the configuration wizard, I get a 500 Internal Server Error. What's up?

This is because your webserver doesn't allow you to use certain .htaccess overrides. The Gallery setup script tries to set some PHP settings, but this requires you to set AllowOverride Options FileInfo or disable the overrides. If you have access to your httpd.conf file, add this to it:

        <Directory "/path/to/your/gallery/directory">
         AllowOverride Options FileInfo
        </Directory>
       

If you don't have access to your httpd.conf, delete the .htaccess file in the setup/ directory.

C.2.

I've installed Gallery and all seems well. But when I try to upload an image it says Unable to make thumbnail(0) or Invalid image. What gives?

This is a very common problem. It's usually because the image manipulation program isn't getting called correctly, and this can happen for a number of reasons. To diagnose the problem, follow these steps:

  1. Verify that the binaries (NetPBM or ImageMagick) are installed correctly and are chmodded 0755 (including the directory they are in).

  2. Put Gallery back into configuration mode (see the tutorials earlier in the manual for details)

  3. Re-run the configuration wizard. On step 2, select the option to put Gallery into debug mode. Finish the configuration wizard and secure Gallery (this is described in the configuration wizard tutorial).

  4. Attempt to upload a picture. There will be a whole lot more debugging messages now, and it will help to diagnose the problem. Possible issues are listed below

If you see any of the following messages, the solutions are listed below

  • Error in loading shared libraries -- Indicates that your dynamic library loader can't find a library that it needs. On Linux you can add the directory containing the appropriate library to /etc/ld.so.conf and then run ldconfig -v as root to fix this. If you don't have root access to the server, either contact your host for help or download a new version of ImageMagick or NetPBM and use the new install instead.

  • Abort trap or Segmentation Fault or Cannot execute binary file -- probably means you installed the wrong binaries for your system (e.g. installed the FreeBSD binaries on a Linux system) or you uploaded the binaries in ASCII FTP mode instead of BINARY FTP mode.

  • Permission Denied -- More than likely, your NetPBM directory or the actual NetPBM binaries are not chmodded 0755. It could also mean that your host has disallowed you from executing programs; if this is the case, you must talk to them in order to get it resolved.

  • /usr/bin/convert: Not a JPEG file: starts with 0x0a 0x4d (/home/uspalmer/public_html/gallery/AUTHORS). -- This is a bug that has been fixed with the latest version of Gallery, please upgrade.

  • /usr/local/bin/convert: no delegate for this image format (/home/sites/home/web/albums/album_01/IMGP0215.jpg) -- This means ImageMagick doesn't have the appropriate libraries to handle a type of image format (in this case JPEG). If you have root access, make sure the appropriate image libraries are installed or ask your host to verify this. If not, you can try using NetPBM from the Gallery Download Page, which has all major image formats already included. If you are using FreeBSD and installed ImageMagick from the ports collection, see FAQ C.30.

If you still can't find a solution, try asking in the Gallery Support Forums.

C.3.

My ISP has a really old version of PHP, something before 4.0.4pl1, which Gallery can't work with. What do I do?

First, send them a quick email and ask them if they are willing to upgrade. They should considering a PHP version this old is years and years old, and probably contains security problems. Your only other good option is to install PHP as a CGI, as in FAQ B.3

C.4.

Whenever I try to upload grayscale JPEG images I get a Unable to make thumbnail error. Why?

This is a bug in some versions of NetPBM that cause it to choke on grayscale images. This is fixed in the version of NetPBM available on the Gallery download page.

C.5.

Whenever I try to upload an image in Gallery, I get all these errors about safe mode. How can I fix this?

This is an unfortunate situation, because Gallery cannot run in safe mode. You have three options, listed below (try them in that order).

  1. Email your host asking them to turn off safe mode. They are providing a service to you, and safe mode puts severe limits on that. If they are a good host, they should listen

  2. Try FAQ B.3, where you can use PHP as a CGI. This is usually pretty difficult, if you don't know exactly what you're doing.

  3. Find another host that doesn't use safe mode. Some are listed in the Gallery Hosting Referrals Page

C.6.

Why can't I upload big files (over a megabyte or two)?

Craig Goranson wrote a very informative email about how to fix this.

If you're using Apache 2, especially with something like RedHat, you may need to edit another directive, LimitRequestBody, as described in this forum post. Setting this directive to 0 (i.e. LimitRequestBody 0) will allow you to upload as big a file as you want (until you hit upload_max_filesize and/or post_max_size -- see the above email link for more information).

C.7.

When I try to run configure.sh, I get an error like this: chmod: getting attributes of `setup\r': No such file or directory How do I fix that?

The answer is to simply upload the configure.sh file in ASCII FTP mode

C.8.

When I try to click on the "[login]" link on the Gallery page, nothing happens (no window pops up). What's wrong?

The most common reason for this is that you have JavaScript disabled or limited in your browser. Make sure that JavaScript is allowed to open windows, or else you may not be able to login to Gallery.

The number two reason for this problem is that your login page has a slightly different hostname than the one you used for your gallery. You can check this by right clicking on the login page and selecting Properties to see what its URL is. The common cause for this is that you used a variation on the standard URL to get to your Gallery, and then the browser thinks that the JavaScript popup is actually on a different host and it causes a security exception when the popup tries to control the main window. For example, if you've told Gallery in the config wizard that your gallery is at http://www.menalto.com/photos and then you actually access the Gallery by going to http://menalto.com/photos (note the "www" is missing), you'll still see your Gallery, but you'll experience this problem. The solution is to pick one hostname and stick with it.

C.9.

When I try to login, everything seems to go correctly, but Gallery doesn't log me in?

There could be a few reasons why this doesn't work. Here are some of them

  • If you are on Windows, you need to edit your session.save_path directive in php.ini to a valid directory. This defaults to /tmp which isn't a valid directory on Windows. Change it to a valid temp folder, such as c:\winnt\temp. Then restart your webserver.

    If you don't have access to php.ini, add this to the .htaccess file in your gallery directory.

              php_value session.save_path "c:\winnt\temp"
             

  • Make sure that the session.use_cookies setting is on in php.ini. It defaults to on, but your host may have turned it off. You can verify the setting by putting Gallery into configuration mode and visiting the setup/phpinfo.php page in your browser. Search for that directive.

  • Verify that it is not FAQ C.8

  • Verify that your browser is configured to accept cookies. If you have this functionality turned off, please turn it back on, or Gallery will not work.

  • Put Gallery back into configuration mode and visit the setup/ session_test.php script. Refresh the page and see if the number increases. If it doesn't, you have a problem with sessions. If you have done all of the above steps, you may need to contact your host for help.

C.10.

Why do I see Warning: Undefined variable: GALLERY_BASEDIR... at the top of the page?

Gallery 1.x generates a ton of warnings. We're fixing this in the next release. In the meantime, you need to turn down the error reporting level in your php.ini file so that you don't see these warnings. You can do that by setting error_reporting = E_ALL & ~E_NOTICE in php.ini. Then restart your Apache server.

If you don't see a change after doing this, it's possible that you're editing the wrong php.ini file. Go to gallery/setup/phpinfo.php in your web browser and it will tell you (near the top of the file) where it thinks your php.ini file is located. After making the change, phpinfo() should say that your error_reporting level is "2039".

You can also add this line to your .htaccess file

        php_value error_reporting 2039
       

C.11.

I can successfully upload photos, but when I look in my album all I see are broken image icons. Why?

You've specified an incorrect path to your albums directory in the config wizard. You can fix this by re-running the config wizard and correcting the Albums URL value or you can edit the config.php file and fix the $gallery->app->albumDirURL variable.

C.12.

Why do I get Failed opening 'html_wrap/inline_albumthumb.header.default'

If you unzipped/untarred the Gallery script on a Mac running OS 9.2.1 or less (ie, non OS X), once its uploaded, three files need to be renamed. They are in the HTML_Wrap folder - inline_albumthumb.footer.default , inline_albumthumb.header.default, and inline_gallerythumb.frame.default. The last few characters at the end of these file names will get truncated on the Mac so Gallery won't be able to find them (there will be an error message above and below each photo). Adding the 't' at the end in FTP or Telnet will solve this. This is only a problem if its untarred/gzipped on a Mac. If they are unzipped on the server they will work fine. [Thanks James O'Donnell]

C.13.

Why do I see this error:

        jpegtopnm: WRITING PPM FILE
        option `--quality' doesn't allow an argument?
       

This problem is caused by one of two things:

  1. You have safe mode enabled. Gallery can't run in this environment. See FAQ C.5 for more information

  2. Your NetPBM binaries have a bug. Please use the NetPBM binaries found on the Gallery Download Page.

C.14.

Why, when I try to upload images, does it say No images uploaded ?

This can be caused by one of two things:

  1. FAQ C.6

  2. Your PHP configuration has file uploads disabled. Put Gallery in config mode and open gallery/setup/phpinfo.php in your web browser and search for the file_uploads row. If file_uploads isn't enabled, then you won't be able to upload images to Gallery, and you should talk to your system administrator.

C.15.

Why do I get this error: Warning: fopen(".../albums/team/album.dat.lock","a+")?

This typically happens when your ISP makes a change in your environment (like upgrading PHP or moving things around) without telling you about it. In a nutshell, some of Gallery's files wind up being owned by the wrong user and their permissions become set such that Gallery can no longer write to them. I've never found this to be the result of a bug in Gallery. To fix this, you can change the permissions on your Gallery data files so that Apache can read the files again. This should only happen on Unix. If you have shell access, you can fix it like this:

        cd /path/to/albums
        cd ..
        chmod -R 777 albums
       

If you don't have shell access, you can use your FTP client to recursively (every file and every directory) chmod the albums directory 777. Make sure you chmod the .users directory, which can sometimes be hidden from view. See FAQ C.19 for more details

C.16.

Why do I get the error Allowed memory size of Xxx bytes exhausted ?

[answered by Vallimar] You are exhausting the available memory that PHP has access to. In php.ini there is a config variable named memory_limit that by default is set to 8MB. I quickly exhausted this after uploading a couple thousand images and had to increase it. Edit php.ini and increase it to a larger value (restart Apache afterwards). If you don't have access to php.ini, you can add this line to your .htaccess file.

        php_value memory_limit [new memory limit]
       

Note

When adding that line to .htaccess, you must use a number, in bytes. For example, 8MB would be about 8000000 bytes.

C.17.

Why do I get pnmtojpeg: No such file or directory when uploading images?

In version 9.19 of NetPBM, they changed the name of the ppmtojpeg binary to pnmtojpeg. It's the same binary and serves the same purpose, but it's got a different name. The precompiled binaries provided on the Gallery download page come with ppmtojpeg . The newer stuff that you might get comes with pnmtojpeg . Gallery tries really hard to figure out which one you have available and use it. However, security restrictions can make it impossible for us to tell for sure. So, it's possible that you have one version of the binary and Gallery expects the other. There are several easy solutions (you only need to do one of these):

  1. Copy ppmtojpeg to pnmtojpeg (or vice versa, as the case may be).

  2. Edit your config.php and change $gallery->app->pnmtojpeg to "ppmtojpeg" (or "pnmtojpeg", whichever you have).

  3. Upgrade to Gallery v1.3.4 which lets you specify which one you have in the config wizard.

C.18.

Why do I get this warning: Your script possibly relies on a session side-effect which existed until PHP 4.2.3?

In PHP 4.2.3, they made a change to the way that the session code works that results in PHP generating a warning when a session is created. In order to resolve this, we have to update some code in Gallery. This warning has no effect, except that it shows up on screen. You can make it go away by editing your php.ini and setting

        session.bug_compat_warn to off
       

and restart Apache.

If you don't have access to php.ini, add this line to your .htaccess

        php_flag session.bug_compat_warn off
       

This should be fixed in future versions of Gallery.

C.19.

Why, when I try to upload a .htaccess and chmod it with my FTP client, it "disappears"?

This is because on some FTP clients, the default setting is to hide files that begin with a dot. The file may actually be on the server, but your FTP client isn't programmed to display it. To make these files "reappear", you must change some settings. PixelPoet has written a tutorial for WS_FTP available here: Quick Tips for Chmod with WS_FTP. If you use CuteFTP, see this thread in the forums.

C.20.

Why does uploading pictures on my RedHat 8.0 system result in an error or scewed picture?

In RedHat 8.0, the default web server is Apache 2.0. Unfortunately, PHP and Apache 2 aren't very stable together yet, though current versions of PHP and Apache 2 do work relatively well together. However, there is a bug in the version of PHP distributed with RedHat 8.0 that can corrupt uploads. For information on how to fix these errors or scewed pictures, see this thread in the forums. Keep in mind that these are merely workarounds. The best option is to upgrade your PHP version to the latest from http://www.php.net/

C.21.

Why doesn't Gallery work correctly on my RedHat 9.0 system?

As in Red Hat Linux versions since 8.0, the default web server is Apache 2. Apache 2.0 uses a totally different module API, making it necessary to rewrite all modules for this new version. Unfortunately, the PHP version that Red Hat 9.0 is distributed with has a very buggy interface with Apache 2.0. Some of these bugs have been fixed with the latest version of PHP. Please download the latest version from http://www.php.net/. See this forum post for information on how to compile PHP.

C.22.

How do I use Gallery both from inside my LAN and the internet?

Note

There is a fix planned for future versions of Gallery to allow the config wizard to use relative URLs. Stay tuned.

There are two ways to do this; both are shown below:

  • The easiest way to do this is to use relative URLs in config.php.

    Note

    You will have to redo this each time you run the config wizard, since the config wizard won't accept relative urls.

    You need to edit config.php manually. There are two URLs in that file. Change each of them as follows:

    From: http://www.example.com/gallery http://www.example.com/gallery/albums To: /gallery /gallery/albums (change these URL's to match your Gallery setup)

  • The second method does not require any server-side changes, as the changes you make are made on the client. This may not be the most efficent solution, especially if you have many client computers.

    You need to edit a file called HOSTS on your client machine. The HOSTS file is a ip-address to domain-name mapping file. Adding a line to this file, will make your client look for a local ip instead of an external ip, even if you use a fully qualified domain name.

    Add a line similar to this:

               10.0.0.2	example.com www.example.com
              

    This line will make all requests to example.com (and www.example.com) request the server at 10.0.0.2 (replace this with your server's real LAN IP address).

    Depending on your client's operating system, the HOSTS file will be in a different place. Also note that on Windows clients, you will need to reboot the system for the changes to take place.

    • Windows 95/98/ME C:\windows\hosts

      Note

      By defaults this file in called hosts.sam. It must be renamed hosts for everything to work.

    • Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts

    • Windows XP Home c:\windows\system32\drivers\etc\hosts

    • Linux/Unix /etc/hosts

C.23.

I'm running Gallery 1.3.4, PHP 4.0.4 and I get Call to undefined function: array_search() in view_photo.php?

This is a function that was introduced in PHP 4.0.5. You can upgrade your version of PHP, or if you prefer, make the following change to view_photo.php

Insert the following at line 57 in view_photo.php


if (!function_exists('array_search')) {
        function array_search($needle, $haystack) {
                for ($x=0; $x < sizeof($haystack); $x++) {
                        if ($haystack[$x] == $needle) {
                                return $x;
                        }
                }
                return NULL;
        }
}

      

Note

This has been fixed in Gallery 1.4.0

C.24.

Why, when I edit an album or photo's text, do quotation marks appear as \' (e.g. John Doe\'s Album)?

Your host has magic_quotes_gpc enabled in php.ini This causes form variables with quotes to be escaped with backslashes. Gallery tries to turn off this functionality, but in your case, this didn't succeed. You'll need to contact your host and ask them to turn this directive off, at least just for your site.

Note

As of Gallery 1.4.0, Gallery will strip the slashes from fields so that this does not happen, even if magic_quotes_gpc is on.

C.25.

I can't extract a .tar.gz file on my Windows machine. Why not?

You need to use WinZip twice. (WinZip is a bit weird when it comes to .tar.gz archives).

  1. Unzip, with WinZip, like you have done.

  2. Rename the extracted file (in this example, netpbm1.1-gallery1.0-linux2.2-redhat6.2-intel) from netpbm1.1-gallery1.0-linux2.2-redhat6.2-intel to netpbm1.1-gallery1.0-linux2.2-redhat6.2-intel.tar.

  3. Unzip once more

C.26.

Why do I get an EOF / read error reading magic number error when uploading pictures with NetPBM?

[Answered by forum user Allistah] Replace your NetPBM binaries with binaries from this page. Then add libjpeg.dll which can be downloaded from this page. Unzip the NetPBM binaries and libjpeg into the same directory. Finally, re-run the configuration wizard and provide the path of these new binaries. (original forum post: here).

C.27.

Why do I get errors like this: Warning: open_basedir restriction in effect. File is in wrong directory in /home/johndoe/public_html/gallery/platform/fs_unix.php on line 53?

This is caused by a PHP directive called open_basedir. Basically, your host has mis-configured this directive and not added the directory where Gallery is to the allowed directories where PHP can access and modify files. You'll need to contact them and ask them to add the directory where you website files are located.

C.28.

Why do I get this error: Warning: write failed: No space left on device (28) in Unknown on line 0?

Your host setup a quota for the web server user. Though your account may still have space left, the quota for the web server user has been overrun. Basically, you'll need to contact your host and ask them to cleanup the filesystem and/or adjust the quota. If you are your host, adjust the quota using edquota.

C.29.

Why do I get this error: Warning: exec() has been disabled for security reasons?

Basically, this is a form of safe mode. Gallery requires functions like exec() to perform operations on images. The steps to "fix" this problem are the same as in FAQ C.5.

C.30.

Why can't I upload images using ImageMagick on FreeBSD?

The default install of ImageMagick on FreeBSD doesn't seem to compile with some important image support (e.g. JPEG), so you must explicitly tell it to. There are two ways of doing this.

  1. Compile ImageMagick using this command: cd /usr/ports/graphics/ImageMagick/ && make -DWITH_JPEG -DWITH_TIFF -DWITH_PNG install clean

  2. Add the following lines to /etc/make.conf:

               WITH_JPEG=yes
               WITH_TIFF=yes
               WITH_PNG=yes 
              

    Then uninstall ImageMagick via ports (make deinstall clean) and reinstall it (make install clean)

C.31.

How do I put my Gallery into debug mode?

There are two ways, each pretty much equal in simplicity.

  • Put your Gallery into configuration mode. On Step 2, there will be an option to turn on debug mode. Make sure this is "on" and complete the wizard.

  • Edit config.php manually (use the first option if you are not comfortable modifying PHP files yourself). Change this line

               $gallery->app->debug = "no";
              

    to

               $gallery->app->debug = "yes";