I've got a strange problem on my installation of mediawiki (an extra blank line is emitted as the first line of all pages from my site). This apparently breaks the RSS feeds.
Can anyone suggest a good way to debug where this newline is coming from? I was hoping I can run index.php from the cmd-line, and then at least be able to figure out what's happening here.
Interestingly, I made a second copy of the wiki software in which I've been hacking in trying to debug this, and there, I see my shell prompt as the first line of text. So, something's pretty obviously shelling out during init, but I've currently got no idea what is doing that.
thanks, -Nick
On Dec 5, 2004, at 11:23 AM, Nick Triantos wrote:
I've got a strange problem on my installation of mediawiki (an extra blank line is emitted as the first line of all pages from my site). This apparently breaks the RSS feeds.
Usually this is because some extra whitespace has crept into one of the .php files.
PHP scripts are actually embedded into a surrounding file (generally HTML), though in the case of 'biggish' apps like ours we've generally got a bunch of include files which are code only; everything goes inside <?php ... ?> tags. If there is a blank line at the start, or more than a single newline at the end, then the extra space will be output when the script is loaded. If this comes before output buffering is started that can prevent the output of HTTP headers from the script, or perhaps also damage gzip compression mode, etc.
Check for extra whitespace around the <?php ... ?> tags, particularly in LocalSettings.php or other files you might have modified.
Interestingly, I made a second copy of the wiki software in which I've been hacking in trying to debug this, and there, I see my shell prompt as the first line of text. So, something's pretty obviously shelling out during init, but I've currently got no idea what is doing that.
Now that's just _weird_...
-- brion vibber (brion @ pobox.com)
I checked for that, and didn't find anything obvious (but I didn't read through all the php files, just the usual suspects).
Is there any way to run mediawiki from the php command-line? I'm hoping for something like: php /path/to/mediawiki/index.php "Main_page" or something like that.
thanks much, -Nick
Brion Vibber wrote:
On Dec 5, 2004, at 11:23 AM, Nick Triantos wrote:
I've got a strange problem on my installation of mediawiki (an extra blank line is emitted as the first line of all pages from my site). This apparently breaks the RSS feeds.
Usually this is because some extra whitespace has crept into one of the .php files.
PHP scripts are actually embedded into a surrounding file (generally HTML), though in the case of 'biggish' apps like ours we've generally got a bunch of include files which are code only; everything goes inside <?php ... ?> tags. If there is a blank line at the start, or more than a single newline at the end, then the extra space will be output when the script is loaded. If this comes before output buffering is started that can prevent the output of HTTP headers from the script, or perhaps also damage gzip compression mode, etc.
Check for extra whitespace around the <?php ... ?> tags, particularly in LocalSettings.php or other files you might have modified.
Interestingly, I made a second copy of the wiki software in which I've been hacking in trying to debug this, and there, I see my shell prompt as the first line of text. So, something's pretty obviously shelling out during init, but I've currently got no idea what is doing that.
Now that's just _weird_...
-- brion vibber (brion @ pobox.com)
Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
On Dec 5, 2004, at 12:17 PM, Nick Triantos wrote:
I checked for that, and didn't find anything obvious (but I didn't read through all the php files, just the usual suspects).
Have you tried a clean copy of the source?
Is there any way to run mediawiki from the php command-line? I'm hoping for something like: php /path/to/mediawiki/index.php "Main_page" or something like that.
If you have a CGI-mode PHP executable, you can emulate a CGI environment by setting a few environment variables. I wouldn't expect this to be terribly enlightening, however; if it's adding an extra line you'll probably get the same line but no additional information.
(Note that if you have AdminSettings.php set up, you can use maintenance/eval.php to load up the MediaWiki environment and issue PHP commands interactively in a shell. It's a little fragile, though. For best results make sure PHP has GNU readline support compiled in.)
-- brion vibber (brion @ pobox.com)
Thanks Brion, it turns out that I did have an extra newline after my copy of EasyTimeline.php. That did the trick.
Still, I'd be curious how y'all go about debugging your code. Do you really jus sprinkle printf's throughout?
thanks, -Nick
Brion Vibber wrote:
On Dec 5, 2004, at 11:23 AM, Nick Triantos wrote:
I've got a strange problem on my installation of mediawiki (an extra blank line is emitted as the first line of all pages from my site). This apparently breaks the RSS feeds.
Usually this is because some extra whitespace has crept into one of the .php files.
PHP scripts are actually embedded into a surrounding file (generally HTML), though in the case of 'biggish' apps like ours we've generally got a bunch of include files which are code only; everything goes inside <?php ... ?> tags. If there is a blank line at the start, or more than a single newline at the end, then the extra space will be output when the script is loaded. If this comes before output buffering is started that can prevent the output of HTTP headers from the script, or perhaps also damage gzip compression mode, etc.
Check for extra whitespace around the <?php ... ?> tags, particularly in LocalSettings.php or other files you might have modified.
Interestingly, I made a second copy of the wiki software in which I've been hacking in trying to debug this, and there, I see my shell prompt as the first line of text. So, something's pretty obviously shelling out during init, but I've currently got no idea what is doing that.
Now that's just _weird_...
-- brion vibber (brion @ pobox.com)
Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
On Dec 5, 2004, at 1:38 PM, Nick Triantos wrote:
Thanks Brion, it turns out that I did have an extra newline after my copy of EasyTimeline.php. That did the trick.
Still, I'd be curious how y'all go about debugging your code. Do you really jus sprinkle printf's throughout?
Sprinkling printfs is a time-honored tradition. ;)
I should note that Zend Studio (a closed-source product, gratis for personal use with limitations) is a PHP-centric IDE which allows you to set breakpoints, single-step, and all that fun stuff. I haven't used it much as I've found it awkward to edit in and the CGI interface is hard to control. If anyone knows a PHP debugger interface that doesn't suck, I'd love to hear about it.
-- brion vibber (brion @ pobox.com)
Also, in case you missed it, you might want to try using the wfDebug function from the GlobalFunctions file. You will need to set the $wgDebugLogFile variable to the location where you want your debug trace logged.
/Jonah
----- Original Message ----- From: "Brion Vibber" brion@pobox.com Newsgroups: gmane.science.linguistics.wikipedia.technical Sent: Wednesday, December 08, 2004 9:42 PM Subject: Re: Debugging suggestions?
Wikitech-l mailing list Wikitech-l@wikimedia.org http://mail.wikipedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org