Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-07 19:20:13

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

[issue] Running site in debugging mode gives internal server error

This is just for your information; not sure what, if anything, can be done about it.

I Just did a fresh install of the development 4 branch on Dreamhost. Out of the box, everything works fine. I then installed the blueprinted theme and switched to debug mode to be met with 500 internal server errors on the public interface, the admin interface continued to operate correctly throughout with no errors or warnings on the admin > diagnostics screen.

Next step: regress to 4.0.5 standard install and try again… same problem.

A little digging shows that it’s tag errors from the needed, but inactive, rss_auto_excerpt plugin. Simply activating the plugin solves the problem but, IMO, the observed result isn’t what I’d expect.

Mode Expected result Actual result
live Renders, minus output from inactive plugins’ tags, with no tag errors or warnings output As expected
testing Renders, minus output from inactive plugins’ tags, plus tag warnings or errors As expected with a ‘Tag error: <txp:rss_auto_excerpt words=“30” /> -> Textpattern Warning: tag does not exist on line 973’
debugging Renders, minus output from inactive plugins’ tags, plus tag errors or warnings & debug backtrace Internal Server Error (with 6.5meg core dump into install directory!)

Diagnostics…

Textpattern version: 4.0.5 (r2466)
Last Update: 2007-12-07 18:40:12/2007-07-01 20:03:44
Document root: /home/xxxxxxxxxx/yyyy.zzzz.com (/home/xxxxxxxxxx/yyyy.zzzz.com)
$path_to_site: /home/xxxxxxxxxx/yyyy.zzzz.com
Textpattern path: /home/xxxxxxxxxx/yyyy.zzzz.com/textpattern
Permanent link mode: section_id_title
Temporary directory path: /home/xxxxxxxxxx/yyyy.zzzz.com/textpattern/tmp
Site URL: yyyy.zzzz.com
PHP version: 5.2.3
GD Image Library: bundled (2.0.34 compatible); supported formats: GIF, JPG, PNG.
Server Local Time: 2007-12-07 11:11:55
MySQL: 5.0.24a-standard-log
Locale: en_GB.UTF-8
Server: Apache/2.0.54 (Unix) PHP/4.4.7 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2
PHP Server API: cgi-fcgi
RFC 2616 headers: 0
Server OS: Linux 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+++opt+c6+gr2b-v6.192
.
.htaccess file contents: 
------------------------
#DirectoryIndex index.php index.html
.
#Options +FollowSymLinks
#Options -Indexes
.
<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/
.
	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^(.+) - [PT,L]
.
	RewriteRule ^(.*) index.php
</IfModule>
.
#php_value register_globals 0
------------------------
.
Charset (default/config): latin1/utf8
character_set_client: utf8
character_set_connection: utf8
character_set_database: latin1
character_set_filesystem: binary
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8
character_sets_dir: /data/mysql/xxxxxxxxxx.yyyy.zzzz/share/mysql/charsets/
17 Tables: -
.
PHP extensions: libxml, xsl/0.1, xmlwriter/0.1, dom/20031129, xmlreader/0.1, xml, tokenizer/0.1, session, pcre, SimpleXML/0.1, SPL/0.2, PDO/1.0.4dev, SQLite/2.0-dev, standard/5.2.3, Reflection/0.1, pspell, posix, pdo_sqlite/1.0.1, pdo_mysql/1.0.2, mysqli/0.1, mysql/1.0, mcrypt, mbstring, json/1.2.1, imap, iconv, hash/1.0, gettext, gd, ftp, filter/0.11.0, exif/1.4 $Id: exif.c,v 1.173.2.5.2.19 2007/02/27 03:04:40 iliaa Exp $, date/5.2.3, curl, ctype, calendar, zlib/1.1, openssl, cgi-fcgi, Zend Optimizer
.
/include/txp_category.php: r2243 (3706fea923cd77f7053f7803de169df4)
/include/txp_plugin.php: r1917 (c63f72f33986c08367672fc9fe7b42dd)
/include/txp_auth.php: r2356 (33255ec1ea1a825163c78272496d8783)
/include/txp_form.php: r1913 (ecea3fecf9d7d1f8088cda67f097eceb)
/include/txp_section.php: r1891 (1f0121b3e2969d94bc8a7fb98bfdfbd5)
/include/txp_tag.php: r2260 (1bd67bdb9dcfb72e34ea967e39406216)
/include/txp_list.php: r2450 (997a3b1bec7115bf49b76f62b28da146)
/include/txp_page.php: r2099 (56bde34b6c7bcb9123ac91e73065e894)
/include/txp_discuss.php: r2451 (91e0b29ef39a9471ae5c78d0b1bba086)
/include/txp_prefs.php: r2405 (a4b76476930b2376199f23fbfd5f1ac9)
/include/txp_log.php: r2439 (16730c34e2a437dd88b8f5cc7eff8218)
/include/txp_preview.php: r1238 (696728f35f3557b648c011bb4d6496c3)
/include/txp_image.php: r2439 (9fac6ed0d9d4c3d8196492051f38dc9a)
/include/txp_article.php: r2453 (bdac8fcac5df2f93f10afa7e50c3fb6f)
/include/txp_css.php: r2403 (4e8c52bb1cf5bfe2e2f0640892f9b92e)
/include/txp_admin.php: r2403 (f8700a3d453ece08e7f137b47c967eda)
/include/txp_link.php: r2463 (0a0171bf606296106332d3fdcb83a678)
/include/txp_diag.php: r2361 (dccf3269049dd25e59afdd7ad8d235cd)
/include/txp_file.php: r2403 (e62abd5fcadabe629322ed17135d89eb)
/include/txp_import.php: r1238 (70a6207c0f3604ecfc4b20369986c4d7)
/lib/admin_config.php: r1747 (a2eb09f94d7902a6e95750fc4abcea17)
/lib/txplib_misc.php: r2464 (615afd44a10311f1c0b7852d9bc15d24)
/lib/taglib.php: r1535 (9b519f9dc88791e5ee8eacc029dd6975)
/lib/txplib_head.php: r2404 (2e067b25997cf67cddbdd365570e69d5)
/lib/classTextile.php: r2462 (a031e2ea894e339711c601f230c5ee71)
/lib/txplib_html.php: r2403 (97e173da3058b438513df67fd7d1ceca)
/lib/txplib_db.php: r2406 (5ed67642f805639b54e381fb22efd208)
/lib/IXRClass.php: r765 (137b91497628f0058a2fca9eba5c3b7f)
/lib/txplib_forms.php: r2403 (438a734b52acef40b36d8a3ba23987e8)
/lib/class.thumb.php: r2329 (b2a2fda54371dbd6c40ba553941f090e)
/lib/constants.php: r2361 (ab6d51668fab1e3c98e7d520b1a59f0f)
/lib/txplib_update.php: r1239 (10f28a986d23187b436369dc29ab552f)
/lib/txplib_wrapper.php: r2286 (419125ec74a17a70bf1e86ebfcd45253)
/publish/taghandlers.php: r2444 (cc9de8f2018b01398a2ba542c5f5bdc6)
/publish/atom.php: r2402 (46c4402717f695fde0d49d806adfa4c4)
/publish/log.php: r1637 (5254d0f3942086bc55723923307a51db)
/publish/comment.php: r2460 (2d1ae1dec0784f044e7005fa5ed50930)
/publish/search.php: r1748 (8c86ebcb5be08e214d81ca15a32164ca)
/publish/rss.php: r2393 (09aac29bf22ffa71c1e118e851cff3c3)
/publish.php: r2436 (7087864f1e7c6efe096d3b8e07c350b1)
/index.php: r2466 (30ecf35de5c1edc6ef68e780c8c79daa)
/css.php: r944 (8beba8f83a091068723435cdcdc02f2f)

[Note: Periods ‘.’ inserted at start of blank lines to preserve textile block-code formatting.]

Last edited by net-carver (2008-06-19 05:10:45)


Steve

Offline

#2 2007-12-07 20:52:07

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [issue] Running site in debugging mode gives internal server error

net-carver wrote:

[Note: Periods ‘.’ inserted at start of blank lines to preserve textile block-code formatting.]

Steve, you can have blank lines: use bc.. :) (You will need to escape the code block by starting the first real paragraph with p.)

Offline

#3 2007-12-08 00:24:05

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: [issue] Running site in debugging mode gives internal server error

I’ve also gotten a 500 error in debugging mode – in my case, it was outputting a nonexistent form that caused it. No error notice, just an internal server error (plus the core.whatever files too).

Offline

#4 2007-12-11 03:47:42

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [issue] Running site in debugging mode gives internal server error

A little digging shows that it’s tag errors from the needed, but inactive, rss_auto_excerpt plugin. Simply activating the plugin solves the problem but, IMO, the observed result isn’t what I’d expect.

Hmm.

Open up textpattern/lib/txplib_misc.php, find the function tagErrorHandler() (line 485) and comment out the lines (499-500) that look like:

		if ($production_status == 'debug')
			print "\n<pre style=\"padding-left: 2em;\" class=\"backtrace\"><code>".escape_output(join("\n", get_caller(10)))."</code></pre>";

Does that change anything?

Offline

#5 2007-12-11 05:20:12

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [issue] Running site in debugging mode gives internal server error

Mary

Ok. Tested the changes you posted and the 500 error is now history. Output as for ‘testing’ mode now.


Steve

Offline

#6 2007-12-11 05:55:42

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [issue] Running site in debugging mode gives internal server error

Els wrote:

Steve, you can have blank lines: use bc.. :) (You will need to escape the code block by starting the first real paragraph with p.)

Ergh? Sorry, I’m being dumb today Els… didn’t know there was a bc.. (two periods) option. Ok, I’ll try that out next time I have to post code with blank lines — thanks.


Steve

Offline

#7 2007-12-11 12:56:59

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [issue] Running site in debugging mode gives internal server error

Mary

Ok, some experimenting with the lines that generate the stack trace shows something interesting…

if ($production_status == 'debug')
	{
	# This works...
	$callers = get_caller(10);
	$callers = join( "\n", $callers );
	$callers = escape_output( $callers );
	print "\n<pre style=\"padding-left: 2em;\" class=\"backtrace\"><code>".$callers."</code></pre>";

	# But this blows the server away...
#	$callers = join( "\n", get_caller(10) );
#	$callers = escape_output( $callers );
#	print "\n<pre style=\"padding-left: 2em;\" class=\"backtrace\"><code>".$callers."</code></pre>";
	}

Weird but true.

Edited to add: The following is as minimal as I can make the change and still have it work…

$callers = get_caller(10);
print "\n<pre style=\"padding-left: 2em;\" class=\"backtrace\"><code>".escape_output( join( "\n", $callers ) )."</code></pre>";

As you can see, it’s using the return value of get_caller() as an argument to the join() that’s the culprit. Searching php.net comments for join() and implode() doesn’t seem to turn up any reports of this being a problem.

Els

Thanks! That worked just fine.

Last edited by net-carver (2007-12-11 13:28:07)


Steve

Offline

#8 2007-12-11 14:07:12

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [issue] Running site in debugging mode gives internal server error

Steve, which PHP version are you using?

Offline

#9 2007-12-11 14:11:53

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [issue] Running site in debugging mode gives internal server error

Ruud

PHP version: 5.2.3 (and the head post has full diagnostics. <grin>)


Steve

Offline

#10 2007-12-11 17:27:43

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: [issue] Running site in debugging mode gives internal server error

What happens if you add this at the beginning of the # This works... part:

echo var_dump(get_caller(10));

And what does the webserver error_log give as a reason for the 500 error?

Offline

#11 2007-12-12 01:01:00

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [issue] Running site in debugging mode gives internal server error

Ruud

Error log says Premature end of script headers: php5.cgi at the time of the server error.

The echo vardump(... line produces…

array(10) { [0]=>  string(43) "textpattern/publish.php:973 trigger_error()" [1]=>  string(13) "processTags()" [2]=>  string(51) "textpattern/publish.php:922 preg_replace_callback()" [3]=>  string(44) "textpattern/lib/txplib_misc.php:1412 parse()" [4]=>  string(40) "textpattern/publish.php:704 parse_form()" [5]=>  string(40) "textpattern/publish.php:808 doArticles()" [6]=>  string(43) "textpattern/publish.php:509 parseArticles()" [7]=>  string(37) "textpattern/publish.php:963 article()" [8]=>  string(13) "processTags()" [9]=>  string(51) "textpattern/publish.php:922 preg_replace_callback()" }

Weird, looks like I can use the return value as a direct argument to vardump() but not join().


Steve

Offline

#12 2007-12-12 12:56:20

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [issue] Running site in debugging mode gives internal server error

Ruud

Here’s a link to a very similar problem over at bugs.php.net

Edited to add: I say similar in a restricted sense of the word… it’s using the join()/implode() function on php5.2 cgi, whilst the array being join()ed is not null, the solution to the problem is the same in my case as theirs.

Last edited by net-carver (2007-12-12 13:06:09)


Steve

Offline

Board footer

Powered by FluxBB