forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: mylogon on December 19, 2012, 06:54:18 am
-
I am getting that on every install, since Friday/Saturday - I have over 20. I have checked permissions, put a phpinfo file to check that also, re-downloaded and re-uploaded the software, I have attempted to install a new install, yet for every file I get the same Premature end of script headers.
Since all I see that is not working is Coppermine, I am even more confused as there are multiple other sites and scripts working fine, i.e. Wordpress, so I know the php is not the issue. I even tried restoring a backup of php.ini from before this happened and rebuilding apache.
Nothing.
Any help would be appreciated - I have reinstalled clean files right from the main download site. All install are running 1.5.20, so that is not an issue and that is from March anyway, so I have no idea why it "suddenly" stopped.
-
There's currently a similar thread: http://forum.coppermine-gallery.net/index.php/topic,75746.0.html
Please read it and check if anything of that suggestions fixes your issue. If not, please post a link to your gallery.
-
[Thread combined as per Αndré]
I am also getting that on every existing install, since Friday/Saturday - I have over 20. I have checked permissions, put a phpinfo file to check that also, re-downloaded and re-uploaded the software, I have attempted to install a new install, yet for every file I get the same Premature end of script headers.
Since all I see that is not working is Coppermine, I am even more confused as there are multiple other sites and scripts working fine, i.e. Wordpress, so I know the php is not the issue. I even tried restoring a backup of php.ini from before this happened and rebuilding apache.
Nothing.
Any help would be appreciated - I have reinstalled clean files right from the main download site. All install are running 1.5.20, so that is not an issue and that is from March anyway, so I have no idea why it "suddenly" stopped on all installs at the same time.
-
Sample Gallery:
Http://surrealsf.com/photos (http://Http://surrealsf.com/photos)
-
Ok, that's weird, the link shows bad:
http://surrealsf.com/photos/ (http://surrealsf.com/photos/)
-
Please don't hijack threads, that's not what I asked for. Unfortunately you just posted the same information again.
check if anything of that suggestions fixes your issue
If not, report what exactly you have tried/checked. It should at least work with the (currently) last suggestion (http://forum.coppermine-gallery.net/index.php/topic,75746.msg365203.html#msg365203).
-
I misunderstood.
To restate:
I checked all permission - correct. Host even has a script to check that. (permissions are correct, when i upload a phpinfo file to the same directory it works correctly -as other person has too.)
I placed a phpinfo file in the directory and it worked
I recomplied apache - no change
I restored a version of php.ini from before the apache rebuild - no change
I did a check of all mysql databases -all were ok
I rebooted the computer - no change
I reinstalled a new download direct from the website - no change
I created a new installation - no change
I manually updated ImageMagick - as server is Centos and their version is ancient - no change
I tried putting:
error_reporting(E_ALL);
ini_set('display_errors', '1');
Into the top of login.php and index.php - did not show anything
I tried:
php_flag log_errors on
php_value error_log /home/path/public_html/domain/PHP_errors.log
in the .htaccess file (of course with the correct domains and paths
Other sites and scripts that use php are working just fine, i.e. the sample I have http://surrealsf.com/photos (http://surrealsf.com/photos), the main site is php. Wordpress and other installs run fine.
Logs are no where near 2 gigs, as that can cause apache to choke.
Suexex logs show nothing.
Only errors shown are premature, 500 and 404 for the error document, as I removed it to debug.
I am running version 1.5.20, and php and mysql are fine, they have not been updated since the past weekend when they all worked fine. All that has been updated recently:
tail /var/log/yum.log
Dec 04 13:43:01 Updated: tzdata-2012i-2.el5.i386
Dec 04 13:43:02 Updated: newrelic-daemon-3.1.5.120-1.i386
Dec 04 13:43:06 Updated: newrelic-php5-3.1.5.120-1.i386
Dec 05 23:17:08 Installed: kernel-PAE-2.6.18-308.24.1.el5.i686
Dec 05 23:17:09 Updated: kernel-headers-2.6.18-308.24.1.el5.i386
Dec 05 23:17:19 Installed: kernel-PAE-devel-2.6.18-308.24.1.el5.i686
Dec 05 23:17:25 Installed: kernel-2.6.18-308.24.1.el5.i686
Dec 05 23:17:34 Installed: kernel-devel-2.6.18-308.24.1.el5.i686
Dec 19 02:17:14 Updated: libtiff-3.8.2-18.el5_8.i386
Dec 19 02:17:15 Updated: libtiff-devel-3.8.2-18.el5_8.i386
None of that was this weekend, and I updated libtiff after the fact.
-
I want to find out where/why exactly that issue occur. Please report what happens when you upload a test file which contain
<?php
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
define('RESTRICTED_PRIV', true);
echo 'works';
I assume this will work as expected (no error message), so please report what happens if that file contains
<?php
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
define('RESTRICTED_PRIV', true);
require('include/init.inc.php');
echo 'works';
-
They both echo'd works.
-
Do you use FastCGI? Do you have a .htaccess file in the Coppermine root directory?
-
FastCGI is not installed, and I do have the .htaccess. I do not believe that Fastcgi I have ever had installed.
-
Do you have any cgi options or rewrites in the .htaccess?
-
Just the ones that Coppermine puts in. remember, this stopped working on multiple installations at the same time and will not work on a new install. That's what is so weird.
-
Coppermine doesn't come with a .htaccess, that's why I was asking. From the similar issues I've seen EngineRewrite and other things could cause the issue. If you can please post the contents of the .htaccess. Depending on how your server is set up it might try running Coppermine as a CGI script.
When you uploaded the code that Αndré suggested where did you put it? the root of your server or in the Coppermine directory? If it wasn't the Coppermine directory please try it there.
-
I them it in the Coppermine directory.
The .htaccess was put by Coppermine, it's a plugin, but not every installation has one. So, that is not the problem.
##/**************************************************
## Coppermine 1.5.x Plugin - sef_urls
## *************************************************
## Copyright (c) 2003-2007 Coppermine Dev Team
## *************************************************
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
## ********************************************
## $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/branches/cpg1.5.x/plugins/sef_urls/ht-english.txt $
## $Revision: 7195 $
## $LastChangedBy: timoswelt $
## $Date: 2010-02-03 17:58:36 +0100 (Mi, 03 Feb 2010) $
## **************************************************/
#Options FollowSymLinks SymLinksIfOwnerMatch
RewriteEngine on
# Uncomment the following line if your webserver's
# URL is not directly related to physical file paths.
# Update "YOUR_COPPERMINE_ROOT" (just / for root)
#RewriteBase /YOUR_COPPERMINE_ROOT
#
# Search and contact
#
RewriteRule search.html(.*) search.php$1 [NC]
RewriteRule contact.html(.*) contact.php$1 [NC]
#
# Rewrite usrmgr urls
#
RewriteRule usermgr-page-([0-9]*).html(.*) usermgr.php?page=$1$2 [NC]
RewriteRule usermgr.html(.*) usermgr.php$1 [NC]
#
# Rewrite index urls
#
RewriteRule index.html(.*) index.php$1 [NC]
RewriteRule index-([0-9]*)\.html(.*) index.php?cat=$1$2 [NC]
RewriteRule index-([0-9]*)-page-([0-9]*)\.html(.*) index.php?cat=$1&page=$2$3 [NC]
#
# Rewrite thumbnail urls
#
RewriteRule thumbnails-lastupby-([0-9]+)\.html(.*) thumbnails.php?album=lastupby&uid=$1$2 [NC]
RewriteRule thumbnails-lastcomby-([0-9]+)\.html(.*) thumbnails.php?album=lastcomby&uid=$1$2 [NC]
RewriteRule thumbnails-lastupby-([0-9]+)-([0-9]+)-page-([0-9]+)\.html(.*) thumbnails.php?album=lastupby&cat=$1&uid=$2&page=$3$4 [NC]
RewriteRule thumbnails-lastcomby-([0-9]+)-([0-9]+)-page-([0-9]+)\.html(.*) thumbnails.php?album=lastcomby&cat=$1&uid=$2&page=$3$4 [NC]
RewriteRule thumbnails-([a-z0-9]*)-([\-]?[0-9]*)\.html(.*) thumbnails.php?album=$1&cat=$2$3 [NC]
RewriteRule thumbnails-([a-z0-9]*)-page-([0-9]*)\.html(.*) thumbnails.php?album=$1&page=$2$3 [NC]
RewriteRule thumbnails-([a-z0-9]*)-([\-]?[0-9]*)-page-([0-9]*)\.html(.*) thumbnails.php?album=$1&cat=$2&page=$3$4 [NC]
RewriteRule thumbnails-([0-9a-z]*)\.html(.*) thumbnails.php?album=$1$2 [NC]
RewriteRule thumbnails-search-(.*)\.html(.*) thumbnails.php?album=search&search=$1$2 [NC]
#
# Rewrite displayimage urls
#
RewriteRule displayimage-lastcom-([\-]?[0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)-page-([\-]?[0-9]+).html(.*) displayimage.php?album=lastcom&cat=$1&pid=$2&msg_id=$3&page=$4$5 [NC]
RewriteRule displayimage-([a-z0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)\.html(.*) displayimage.php?album=$1&cat=$2&pid=$3&uid=$4&msg_id=$5&page=$6$7 [NC]
RewriteRule displayimage-([a-z0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)\.html(.*) displayimage.php?album=$1&cat=$2&pid=$3&uid=$4$5 [NC]
RewriteRule displayimage-([a-z0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)\.html(.*) displayimage.php?album=$1&cat=$2&pid=$3$4 [NC]
RewriteRule displayimage-([a-z0-9]+)-([\-]?[0-9]+)\.html(.*) displayimage.php?album=$1&pid=$2$3 [NC]
RewriteRule displayimage-([0-9]+)\.html(.*) displayimage.php?pid=$1$2 [NC]
#
# Rewrite users profiles
#
RewriteRule profile-op-([a-z0-9_]+)\.html(.*) profile.php?op=$1 [NC]
RewriteRule profile-([0-9]+)\.html(.*) profile.php?uid=$1$2 [NC]
-
it's a plugin, but not every installation has one. So, that is not the problem.
Thanks for clarifying.
Try installing the latest tarball http://coppermine.svn.sourceforge.net/viewvc/coppermine/trunk/cpg1.5.x/?view=tar other then that I'm out of ideas, maybe Αndré will come up with something else.
-
Installing the development one is something I have not tried, I will. Not sure whether to hope that fixes it or not, as then I have to do about 20 more..
-
I very much doubt that would fix the problm. Yours is definately something server related as I am sure you have guessed. Finding that is not going to be easy.
-
Try installing the latest tarball http://coppermine.svn.sourceforge.net/viewvc/coppermine/trunk/cpg1.5.x/?view=tar
Unfortunately that's not necessarily the latest revision, as we moved our SVN repository recently (which doesn't support tarballs so far), but it still contains some fixes since cpg1.5.20. However, I also doubt it will fix the issue.
My only idea is to do the following. Please disable the sef_urls plugin and delete the .htaccess file temporarily. Then, try to add more and more lines from the original index.php file to the current index.php file on your server. Actually, I expected that it will stop to work with the
require('include/init.inc.php');
line.
My next suspect is the pageheader() function, but please add the code line by line / block by block and check when the error message occurs.
-
Are all of the 20 sites running off of the same host?
Or are you hosting yourself?
-
Here is one more thing to try...
I them it in the Coppermine directory......
...Coppermine 1.5.x Plugin - sef_urls
If you are still running SEF URLs as a plugin, then try uninstalling it through plugin manager. For the test you should not have to delete the .htaccess file.
Yours is definately something server related as I am sure
Agreed,
I suggest this because recently my host changed something and SEF URLs broke Coppermine. Uninstalling it restored CPG. I have not had the time to look into it further (which is bad, because as a result virtually all links listed elsewhere then became broken).
It could be a security setting related issue (?)
-
I am so glad I run my own vm's. That way I know exactly what is updated and can work around any problems that may arise. Usually in these cases hosts try and lock things down in far too a restrictive way. I think in this case the OP should ask their host for advice.
-
I have a dedicated server that does shared hosting - cPanel.
-
OK, 1.4x works, but nothing in 1.5x tree works. Have checked several other php programs and scripts and they all work, just not Coppermine. Cannot debug, as there is no debug that creates a log if it never starts - AFAIK.
-
Have you already done this?
Please disable the sef_urls plugin and delete the .htaccess file temporarily. Then, try to add more and more lines from the original index.php file to the current index.php file on your server. [..] please add the code line by line / block by block and check when the error message occurs.
-
I have installed a new installation without anything at all, but have not gone line by line. What is interesting is that an installing 1.4x works, when 1.5x does not. I was going to do a comp and see what are the big differences in the index.php and try and narrow it down that way.
-
I assume that won't work as expected, as it's not just index.php which probably has changed, but it's more likely some of the files in the include directory which stops your gallery to work.
-
No doubt. I was just trying to not have to do that, as there are 1200+ lines in the index.php....
-
Of course you don't need to add each line separately. I suggest to add whole functions and bigger blocks at once. If it stops to work undo your last change and add less code, until you know which line exactly causes the issue.
-
I do not believe it installs sef_url by default, and I tried a new installation.
Yes, I know you meant function by function.
Yes, it is my dedicated server. I am the only one that has root. All the installations are on this server. That's why all stopping at the same time is so weird, and no other php scripts have a problem.
-
OK, I figured out what is doing it, and I am glad I started from the bottom,
pagefooter();
Now why, I have no idea. And the new install does not have that in it yet, so ???
They must call a function somewhere that is not liked.
-
However, admin.php does call it, and that is what needs to be run first in installation. The install I assume adds that to index.php.
-
If you remove/comment out that line Coppermine works as expected?
If so, please add the following code to your theme's theme.php file:
/******************************************************************************
** Section <<<pagefooter>>> - START
******************************************************************************/
// Function for writing a pagefooter
function pagefooter()
{
/*
//global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
global $USER, $USER_DATA, $CONFIG, $time_start, $query_stats, $queries;
global $template_footer;
$custom_footer = cpg_get_custom_include($CONFIG['custom_footer_path']);
if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
cpg_debug_output();
}
$template_vars = array(
'{GAL_NAME}' => $CONFIG['gallery_name'],
'{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
'{SYS_MENU}' => theme_main_menu('sys_menu'),
'{SUB_MENU}' => theme_main_menu('sub_menu'),
'{ADMIN_MENU}' => theme_admin_mode_menu(),
'{CUSTOM_HEADER}' => $custom_header,
'{JAVASCRIPT}' => theme_javascript_head(),
'{CUSTOM_FOOTER}' => $custom_footer,
'{VANITY}' => (defined('THEME_IS_XHTML10_TRANSITIONAL')) ? theme_vanity() : '',
'{CREDITS}' => theme_credits(),
);
echo template_eval($template_footer, $template_vars);
*/
}
/******************************************************************************
** Section <<<pagefooter>>> - END
******************************************************************************/
That's not the final solution, but it should fix your whole gallery if pagefooter is really the cause. Obviously it currently won't display the footer, as I commented out the whole content. Please report if it works as expected.
-
The first gallery I tried, it worked.
-
It seems to be:
echo template_eval($template_footer, $template_vars);
I comment that line and it bombs
-
I mean Doesn't bomb..
LOL. Backwards there..
-
Does it work if you remove some/all of the template vars? E.g.
function pagefooter()
{
//global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
global $USER, $USER_DATA, $CONFIG, $time_start, $query_stats, $queries;
global $template_footer;
$custom_footer = cpg_get_custom_include($CONFIG['custom_footer_path']);
if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
cpg_debug_output();
}
$template_vars = array(
'{GAL_NAME}' => $CONFIG['gallery_name'],
'{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
);
echo template_eval($template_footer, $template_vars);
}
-
I commented them out one by one, and even when all were commented, it did not work.
// Function for writing a pagefooter
function pagefooter()
{
//global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
global $USER, $USER_DATA, $CONFIG, $time_start, $query_stats, $queries;
global $template_footer;
$custom_footer = cpg_get_custom_include($CONFIG['custom_footer_path']);
if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
cpg_debug_output();
}
$template_vars = array(
/* '{GAL_NAME}' => $CONFIG['gallery_name'],
'{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
'{SYS_MENU}' => theme_main_menu('sys_menu'),
'{SUB_MENU}' => theme_main_menu('sub_menu'),
'{ADMIN_MENU}' => theme_admin_mode_menu(),
'{CUSTOM_HEADER}' => $custom_header,
'{JAVASCRIPT}' => theme_javascript_head(),
'{CUSTOM_FOOTER}' => $custom_footer,
'{VANITY}' => (defined('THEME_IS_XHTML10_TRANSITIONAL')) ? theme_vanity() : '',
'{CREDITS}' => theme_credits(),
*/
);
echo template_eval($template_footer, $template_vars);
*/
-
Wait, I have en error
-
I need to check another gallery. When we had the other pagefooter in, I ran upgrade and it said nothing was changed, and even checked the versions, and nothing of consequence, but the one I was working on seems to work, even after removing the extra pagefooter from the theme.php and restoring the previous version. I just have to doublecheck all my work.
I am just getting loopy right now at 4am, so I am going to have to pick this up when I can be more awake.
Will post back.
-
OK, none of them work when I remove the comments from that code. It errors on $template_footer, so it seems it is not getting that from the earlier
global $template_footer
.
-
Through some process of elimination
$template_footer = substr($template, $gallery_pos);^M
in include/functions.inc.php is what is the kiss of death.
-
Through some process of elimination $template_footer = substr($template, $gallery_pos);^M
in include/functions.inc.php is what is the kiss of death.
Please add
var_dump($template_footer);
die();
below that line and post the HTML output. Don't forget to undo that change.
-
First one:
string(210) "
{CUSTOM_FOOTER}
{CREDITS}
"
Second
string(773) "{CREDITS}
DESIGN BY: zz.COM
COPYRIGHT 2002-2009 - zzz - PRIVACY STATEMENT - TERMS OF USE
"
-
Why are there 2 different outputs?
-
I tried it in two different galleries
-
Totally different approach, but I just recognized it and maybe it fixes your issues. Open include/functions.inc.php, find
function template_eval(&$template, &$vars)
{
return str_replace(array_keys($vars), array_values($vars), $template);
}
and replace with
function template_eval($template, $vars)
{
return str_replace(array_keys($vars), array_values($vars), $template);
}
-
Weird, works for one of the galleries, not the other
-
I am not really picky about the footer, but really want to figure out what/where it is, so when things are updated I do not have to modify all the installations again. Right now, I have just commented out the line and copied the file (and chowned) to most of the installs.
-
Ideally I'd like to check that issue directly on your server. Can you please create a testing gallery and provide a test account (via PM)?