I am getting a configuration error on my embedded gallery module (Gallery 2.2.4/Drupal 5.6). When I go to the configuration screens, everything seems ok and no warnings etc are visible. The gallery appears to work fine in the embedded mode. Attached is the bug report (had to rename from .html to .txt to get it to attach). Any direction or help appreciated.

CommentFileSizeAuthor
gallery_report.html_.txt40.89 KBrkdesantos

Comments

rkdesantos’s picture

Version: 5.x-2.0 » 5.x-2.1
Category: support » bug
Priority: Normal » Critical

Changed this to a bug report. Some of my users intermittently get this message and a white screen:
Fatal error: Call to undefine d function: drupal_get_path() in /home/afana/public_html/drupal5/modules/gallery/gallery.module on line 4

Repeated refreshes and it eventually works and my site appears as it should. I can't predictably create it, it seems to occur at random. Upgrading to 5.x-2.1 did not help.

profix898’s picture

Priority: Critical » Normal

This somehow looks like a php memory issue. Its impossible that drupal_get_path() is undefined as it is located in the common.inc file of Drupal, what is the very heart of Drupal core. Also the problem occuring at random does not point to a bug in the code, otherwise it would never work as expected. What is your php memory configured to? Can you please increase the memory limit and try again!? Most people are happy with 24-32MB but you may need more in case you have dozens of modules and G2 plugins enabled.

rkdesantos’s picture

Upping the memory for Drupal to 50M made no difference; it was at 30M. Gallery is already at 50M.

rkdesantos’s picture

The Drupal log has this which may be related:

Error in function '_gallery_init()' (gallery_base.inc:111):

    * Unable to initialize embedded Gallery. You need to configure your embedded Gallery.
      Error (ERROR_PERMISSION_DENIED) : Invalid return URL! The requested URL http://www.afana.com/drupal5/index.php?q=gallery&g2_view=core.UserAdmin&g2_subView=register.UserSelfRegistration&g2_return=%2Fdrupal%2Fv%2Fess_bris_r8_07%2Fess_bris_r8_07_149.JPG.html%3Fg2_0%3Dgallery&g2_returnName=photo tried to insert a redirection to /drupal/v/ess_bris_r8_07/ess_bris_r8_07_149.JPG.html?g2_0=gallery which is not a part of this Gallery.
          o in modules/core/classes/GalleryUrlGenerator.class at line 863 (gallerycoreapi::error)
          o in modules/rewrite/classes/parsers/modrewrite/ModRewriteUrlGenerator.class at line 42 (rewriteurlgenerator::initnavigation)
          o in init.inc at line 147 (modrewriteurlgenerator::initnavigation)
          o in modules/core/classes/GalleryEmbed.class at line 129
          o in /home/afana/public_html/drupal5/modules/gallery/gallery_base.inc at line 101 (galleryembed::init)
          o in /home/afana/public_html/drupal5/modules/gallery/gallery_base.inc at line 332
          o in /home/afana/public_html/drupal5/modules/gallery/gallery_menu/gallery_menu.module at line 37
          o in ??? at line 0
          o in /home/afana/public_html/drupal5/includes/module.inc at line 406
          o in /home/afana/public_html/drupal5/includes/menu.inc at line 1221
          o in /home/afana/public_html/drupal5/includes/menu.inc at line 220
          o in /home/afana/public_html/drupal5/includes/menu.inc at line 391
          o in /home/afana/public_html/drupal5/index.php at line 15
cjensen’s picture

I can confirm that I'm experiencing the fatal error, as well. My logs don't reveal anything, but that may simply be due to my configuration. Best guess at this point is that the error occurs on cache hits, as I can usually access a page once but get errors if I reload. If so, increasing available memory might make the situation worse... ?

Interestingly, when logged in, I haven't had any problems (yet). Disabling page caching (Administer -> Site configuration -> Performance) altogether appears to get rid of the problem for anonymous users. I guess that's the way to go, for now.

This issue: http://drupal.org/node/183877 looks like it has similar symptoms, though I had no luck getting their code changes to work.

rkdesantos’s picture

Yes, the link to the issue on Calendar module sounds very similar.

It does appear cache related somehow. I tried disabling caching. That didn't make the problem go away for me, however users in admin mode do not see the problem.

profix898’s picture

... tried to insert a redirection to /drupal/v/ess_bris_r8_07/ess_bris_r8_07_149.JPG.html?g2_0=gallery which is not a part of this Gallery

This path is indeed not a valid gallery path, its missing the '/gallery/' part (should be '/drupal/gallery/v/ess_bris_r8_07/...'). Do your rewrite rules include it, i.e. 'gallery/v/%path%'?

Best guess at this point is that the error occurs on cache hits, as I can usually access a page once but get errors if I reload. If so, increasing available memory might make the situation worse... ?

The page cache is a DB table, so increasing php memory (= memory available for executing php scripts) should not make any difference. But still a helpful observation that page cache might be involved here.

Interestingly, when logged in, I haven't had any problems (yet). Disabling page caching (Administer -> Site configuration -> Performance) altogether appears to get rid of the problem for anonymous users. I guess that's the way to go, for now.

I cant tell from memory how Drupal manages the page cache, based on the request url and not going through the menu system at all. I will try to debug this as time permits. Please let me know if you have any additional clues ...

rkdesantos’s picture

Here is the htaccess file for Gallery itself:

AddType application/x-httpd-php5 .php
# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /gallery2/

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_FILENAME} !/gallery2/main\.php$
    RewriteRule .   -   [L]


    RewriteCond %{THE_REQUEST} \ /gallery2/v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_FILENAME} !/gallery2/main\.php$
    RewriteRule .   /gallery2/main.php?g2_view=core.ShowItem&g2_path=%1   [QSA,L]

</IfModule>

# END Url Rewrite section


php_value post_max_size 10M
php_value upload_max_filesize 10M
# php_value memory_limit 58388608

here is the one for Drupal:

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /drupal5/

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php
    RewriteCond %{REQUEST_URI} !/drupal5/index\.php$
    RewriteRule .   -   [L]


    RewriteCond %{THE_REQUEST} \ /drupal5/v/([^?]+)(\?.|\ .)
    RewriteCond %{REQUEST_URI} !/drupal5/index\.php$
    RewriteRule .   /drupal5/index.php?q=gallery&g2_view=core.ShowItem&g2_path=%1   [QSA,L]

</IfModule>

# END Url Rewrite section

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)<IfModule mod_rewrite.c>    
RewriteEngine On    

RewriteBase /drupal5/    

RewriteCond %{REQUEST_FILENAME} -f [OR]    
RewriteCond %{REQUEST_FILENAME} -d [OR]    
RewriteCond %{REQUEST_FILENAME} gallery\_remote2\.php    
RewriteCond %{REQUEST_FILENAME} !/drupal5/index\.php$    
RewriteRule .   -   [L]    

RewriteCond %{THE_REQUEST} \ /drupal5/gallery/([^?]+)(\?.|\ .)    
RewriteCond %{REQUEST_FILENAME} !/drupal5/index\.php$    
RewriteRule .   /drupal5/index.php?q=gallery&g2_view=core.ShowItem&g2_path=%1   [QSA,L]

</IfModule>
# END Url Rewrite section#

# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<Files ~ "(\.(inc|module|pl|sh|sql|theme|engine|xtmpl)|Entries|Repositories|Root|scripts|updates)$">
  Order deny,allow
  Deny from all
</Files>

# Set some options.
Options -Indexes
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

php_value max_execution_time 360
# Override PHP settings. More exist in sites/default/settings.php, but
# the following cannot be changed at runtime. The first IfModule is
# for Apache 1.3, the second for Apache 2.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value upload_max_filesize           24000000
  php_value post_max_size                 24000000
  php_value max_input_time                360
  php_value file_uploads                    1
  php_value max_execution_time            480
  php_value memory_limit                  50000000


</IfModule>

<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value upload_max_filesize           24000000
  php_value post_max_size                 24000000
  php_value max_input_time                1200
  php_value file_uploads                    1
  php_value max_execution_time            360
  php_value memory_limit                  50000000





</IfModule>

# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal5

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

Does this give you any insight?

I disabled the gallery module for the moment because otherwise my site is unusable.

profix898’s picture

Status: Active » Closed (duplicate)