Premature end of script headers: index.php

woollypigs
woollypigs's picture

Joined: 2011-12-13
Posts: 10
Posted: Thu, 2012-10-11 08:29

Hi

I tried to update from 3.0.3 to 3.0.4 but had no luck, nothing happened. I tried to poke around and ended up with a 500 error. So I decided to backup and start with a fresh install.

I uploaded the files to the server plus the var folder made sure that the files were chmod 777.
I tried to edit the short flat according to this : http://codex.gallery2.org/Gallery3:FAQ#I_get_an_error_500_when_I_visit_my_Gallery_3_install_for_the_first_time but no joy.

I have followed these steps to the letter : http://codex.gallery2.org/Gallery3:User_guide:Gallery3:Installing_and_upgrading#Upgrading

When I go to http://www.woollypigs.com/galleries I get a 500 error. When I look in my error log (no the one in var/log) I see this :

[Thu Oct 11 08:47:01 2012] [error] [client xxx.xxx.xxx.xx] Premature end of script headers: index.php

Have no clue what that means.

The very last log entry on var/logs is here, before it went wrong :

2012-10-10 17:26:27 +01:00 --- error: Database_Exception [ 44 ]: #2002: No such file or directory
/home/sites/woollypigs.com/public_html/galleries/system/libraries/Database_Mysqli.php [ 33 ]
#0 /home/sites/woollypigs.com/public_html/galleries/system/libraries/Database_Mysqli.php(85): Database_Mysqli_Core->connect()
#1 /home/sites/woollypigs.com/public_html/galleries/system/libraries/Database.php(429): Database_Mysqli_Core->escape('var_cache')
#2 [internal function]: Database_Core->quote('var_cache')
#3 /home/sites/woollypigs.com/public_html/galleries/system/libraries/Database_Builder.php(764): array_map(Array, Array)
#4 /home/sites/woollypigs.com/public_html/galleries/system/libraries/Database_Builder.php(1021): Database_Builder_Core->compile_conditions(Array)
#5 /home/sites/woollypigs.com/public_html/galleries/modules/kohana23_compat/libraries/MY_Database_Builder.php(48): Database_Builder_Core->compile()
#6 /home/sites/woollypigs.com/public_html/galleries/system/libraries/Database_Builder.php(957): Database_Builder->compile()
#7 /home/sites/woollypigs.com/public_html/galleries/modules/gallery/libraries/drivers/Cache/Database.php(105): Database_Builder_Core->execute()
#8 /home/sites/woollypigs.com/public_html/galleries/system/libraries/Cache.php(141): Cache_Database_Driver->get(Array, true)
#9 /home/sites/woollypigs.com/public_html/galleries/modules/gallery/helpers/module.php(430): Cache_Core->get('var_cache')
#10 /home/sites/woollypigs.com/public_html/galleries/modules/gallery/config/locale.php(36): module_Core::get_var('gallery', 'timezone', 'Europe/London')
#11 /home/sites/woollypigs.com/public_html/galleries/system/libraries/drivers/Config/Array.php(70): require('/home/sites/woo...')
#12 /home/sites/woollypigs.com/public_html/galleries/system/libraries/drivers/Config.php(111): Config_Array_Driver->load('locale', false)
#13 /home/sites/woollypigs.com/public_html/galleries/system/core/Kohana_Config.php(121): Config_Driver->get('locale.language', false, false)
#14 /home/sites/woollypigs.com/public_html/galleries/system/core/Kohana.php(385): Kohana_Config_Core->get('locale.language', false, false)
#15 /home/sites/woollypigs.com/public_html/galleries/system/core/Kohana.php(150): Kohana_Core::config('locale.language')
#16 /home/sites/woollypigs.com/public_html/galleries/application/Bootstrap.php(49): Kohana_Core::setup()
#17 /home/sites/woollypigs.com/public_html/galleries/index.php(102): require('/home/sites/woo...')
#18 {main}

Am I right that I have to set my .htaccess file up like this? To have gallery3 to run in the galleries folder aka www.woollypigs.com/galleries

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /galleries
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^index.php/(.*) $1 [QSA,R,L]
</IfModule>

Do I need to change the .htaccess file in my root folder (where I run a wordpress blog) I know this have worked before but now for the life of me I can't get it to behave.

I just had a poke around while typing this I found that if I edit my root .htaccess to have RewriteEngine Off and my /galleries .htaccess to have RewriteBase / (not /galleries) I get the page a wordpress but not a gallery3 page.

Any pointers ?

Sorry for rambling, it is getting late and I'm confused :)
Thanks
woolly
http://www.woollypigs.com

 
woollypigs
woollypigs's picture

Joined: 2011-12-13
Posts: 10
Posted: Fri, 2012-10-12 02:57

Anywoo I managed to get it back to work again, after playing around .htaccess. Though the funny thing is that I downloaded and installed 3.0.4 on the server, but I get this error - A newer version of Gallery is available! Upgrade now to version 3.0.4 (remind me later) Go figure.

http://www.woollypigs.com

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2012-10-12 13:00
woollypigs wrote:
Anywoo I managed to get it back to work again, after playing around .htaccess

It may be useful to post more info on what htaccess conflict caused the error and more info on the solution (for anyone else that runs into this issue and find the thread).

 
woollypigs
woollypigs's picture

Joined: 2011-12-13
Posts: 10
Posted: Fri, 2012-10-12 17:53

You are right :)

After many different set up where I either got an 500 error or the blank galleries page in wordpress. I ended up with this in the .htaccess in my root folder.

# Switch rewrite engine off in case this was installed under HostPay.
RewriteEngine Off

SetEnv DEFAULT_PHP_VERSION 5

DirectoryIndex index.cgi index.php index.html

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

And this in the .htaccess in the /galleries folder where Gallery 3.0.4 (I know I downloaded that version)

# Set some reasonable defaults for PHP. Most of these cannot be set
# inside the script itself. For hosts that don't have .htaccess
# support but do support per-dir php.ini files, these settings are
# mirrored in php.ini
#
<IfModule mod_php5.c>
php_flag short_open_tag On
php_flag magic_quotes_gpc Off
php_flag magic_quotes_sybase Off
php_flag magic_quotes_runtime Off
php_flag register_globals Off
php_flag session.auto_start Off
php_flag suhosin.session.encrypt Off
php_value upload_max_filesize 20M
php_value post_max_size 100M
</IfModule>

# Try to disable the parts of mod_security that interfere with the
# Flash uploader
#
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

# Increase security by uncommenting this block. It keeps browsers
# from seeing support files that they shouldn't have access to. We
# comment this out because Apache2 requires some minor configuration
# in order for you to use it. You must specify "AllowOverride Limit"
# in your Apache2 config file before you uncomment this block or
# you'll get an "Internal Server Error".
#
# <FilesMatch "(\.(class|fla|gitignore|inc|ini|sql|txt)|(README|LICENSE|.build_number))$">
# Order deny,allow
# Deny from all
# </FilesMatch>
# <FilesMatch "robots.txt">
# Order allow,deny
# Allow from all
# </FilesMatch>

# Improve performance by uncommenting this block. It tells the
# browser that your images don't change very often so it won't keep
# asking for them. If you get an error after uncommenting this, make
# sure you specify "AuthConfig Indexes" in your Apache config file.
#
<IfModule mod_expires.c>
ExpiresActive On
# Cache all files for a month after access (A).
ExpiresDefault A2678400
# Do not cache dynamically generated pages.
ExpiresByType text/html A1
</IfModule>

# You can use the mod_rewrite Apache module to get rid of the
# "index.php" from your Gallery 3 urls. Uncomment the block below
# inside the <IfModule> ... </IfModule> lines and then edit the
# RewriteBase line to match your Gallery 3 URL.
#
# Here are some RewriteBase values:
# Gallery 3 URL RewriteBase line
# ============= ====================
# http://example.com/gallery3 RewriteBase /gallery3
# http://example.com/~bob/photos RewriteBase /~bob/photos
# http://gallery3.example.com/ RewriteBase /
#
# Then just use your Gallery 3 without the index.php in the url.
#
# NOTE: future upgrades of Gallery 3 will overwrite this file! If you
# want these changes to be persistent, talk to your system admin about
# putting this block into your Apache config files.
#

DirectoryIndex index.cgi index.php

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /galleries/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^index.php/(.*) $1 [QSA,R,L]
</IfModule>

http://www.woollypigs.com