Recent Topics

1 May 16, 2007 09:43    

Hi all,

when trying to post directly via cellphone and mms.php I see the following errors in the Apache error.log:

[Wed May 16 09:28:23 2007] [error] [client 212.23.126.23] FastCGI: server "/var/www/php-fcgi-scripts/www.domain.tld/php-fcgi-starter" stderr: PHP Notice:  Undefined variable: default_category in /var/www/http/www.domain.tld/blog/cron/mms.php on line 28
[Wed May 16 09:28:23 2007] [error] [client 212.23.126.23] FastCGI: server "/var/www/php-fcgi-scripts/www.domain.tld/php-fcgi-starter" stderr: PHP Notice:  Undefined variable: HTTP_RAW_POST_DATA in /var/www/http/www.domain.tld/blog/cron/mms.php on line 30

Where can I set the variable default_category?

And what can I do about this HTTP_RAW_POST_DATA thing? I already tried to "register_globals = On" and "always_populate_raw_post_data = On" in php.ini, but it had no effect.

Thank you for your help,

Roi

/EDIT: I'm using b2evo 1.9.3.

2 May 16, 2007 10:49

Hi again,

a little bit more information: The above issue came up when trying to post with a Nokia 6233 cellphone.

The same configuration works with a Nokia 6230i, but creates an error on the phone. The post makes it into the blog either. I think the error results out of the following which appears in the Apache error.log:

[Sun Apr 29 16:32:39 2007] [error] [client 212.23.126.5] FastCGI: server "/var/www/php-fcgi-scripts/www.domain.tld/php-fcgi-starter" stderr: PHP Notice:  Undefined variable: default_category in /var/www/http/www.domain.tld/blog/cron/mms.php on line 28
[Sun Apr 29 16:32:39 2007] [error] [client 212.23.126.5] FastCGI: server "/var/www/php-fcgi-scripts/www.domain.tld/php-fcgi-starter" stderr: PHP Notice:  Undefined variable: res in /var/www/http/www.domain.tld/blog/cron/mms.php on line 208
[Sun Apr 29 16:32:39 2007] [error] [client 212.23.126.5] FastCGI: server "/var/www/php-fcgi-scripts/www.domain.tld/php-fcgi-starter" stderr: PHP Warning:  Cannot modify header information - headersalready sent by (output started at /var/www/http/www.domain.tld/blog/cron/mms.php:28) in /var/www/http/www.domain.tld/blog/cron/mms.php on line 222

Is this just here and a local user problem or does mms.php needs a little rejuvenating cure process? ;-)

Regards,
Roi

3 May 16, 2007 11:43

I'd say that mms.php needs a little lurv ;)

To cure your $default_category error try adding the value just before line 28.

$default_category = 1;// replace with your category of choice
param( 'cat', 'integer', $default_category, true );

To cure your $res problem add the two new lines in this section :

function textDecode( $text )
{
$res = '';// define $res
	if ( ord( $text{0} ) == 0xff && ord( $text{1} ) == 0xfe )
	{
		for ( $i = 2; $i < strlen( $text ); $i += 2 ) $res .= $text{$i};
		return $res;
        }
	return $text;
}


function toString( $data )
{
$res = '';//define $res
	for ( $i = 0; $i < sizeof( $data ); $i++ ) $res .= chr( $data[$i] );
	return $res;
}

Hopefully that'll help, but I don't use blog by mms so I'm guessing ;)

¥

4 May 16, 2007 13:26

Hi ¥åßßå,

and thank you for the fast answer.

I'm not a php programmer so I'm very thankful for this kind of stuff. ;-)

The first error disappeared, the second error is still there, now line 31:

[Wed May 16 09:28:23 2007] [error] [client 212.23.126.23] FastCGI: server "/var/www/php-fcgi-scripts/www.domain.tld/php-fcgi-starter" stderr: PHP Notice:  Undefined variable: HTTP_RAW_POST_DATA in /var/www/http/www.domain.tld/blog/cron/mms.php on line 30

What can I do about this? This seems to be a real showstopper...

Whether the "res" error in line 208 disappeared I cannot say. The scripts terminates in line 30.

And what do you think about the headers already sent error in line 222?

Regards,
Roi

5 May 16, 2007 13:38

Ok, this may or may not work, add ths bit just above line 30 :-

if ( !isset( $HTTP_RAW_POST_DATA ) ) $HTTP_RAW_POST_DATA =file_get_contents( 'php://input' );

The header error is just a knock on effect of your first error

¥

*edit* correcting line number

6 May 16, 2007 13:45

Hey thanks again! :-)

¥åßßå wrote:

Ok, this may or may not work, add ths bit just above line 30 :-

I added this directly above line 30.

[Wed May 16 13:40:22 2007] [error] [client 212.23.126.20] FastCGI: server "/var/www/php-fcgi-scripts/www.domain.tld/php-fcgi-starter" stderr: PHP Fatal error:  Allowed memory size of 16777216 bytes exhausted (tried to allocate 35 bytes) in /var/www/http/www.domain.tld/blog/cron/mms.php on line 266

Outch... The MMS is only 191 KB, hmmm.

function MMSDecoder( $data )
{
        $datalen = strlen( $data );
        for ( $i = 0; $i < $datalen; $i++ ) $this->data[$i] = ord( $data{$i} );
        $this->curp = 0;
}

...where the "for"-line is line 266.

I'll try to increase PHP memory, but I don't think this will help. I'll be back when I tried this.

Regards,
Roi

7 May 16, 2007 13:50

Roi wrote:

I'll try to increase PHP memory, but I don't think this will help. I'll be back when I tried this.

IT WORKED!!! :) I increased the memory limit to 32MB and it worked...

Thank you so much!

Interesting, what is this script doing with a 191KB MMS message?

Also intersting that the Nokia 6233 isn't resizing the images. I got a 1600x1200 picture into my blog... 8| :roll:

BTW: Will these changes go into the next release of b2evo?

BTW2: Do you accept other changes? I'm asking because I changed some other stuff in mms.php for support for German special characters. Are you interested in this?

8 May 16, 2007 13:56

Glad it worked for you. The latest versions of the evocore require more memory than older versions ... mind you, they do a shedload more as well ;)

I'll have to look into the changes to make sure they're the best solution before I could say whether they'd get into the next version or not.

Feel free to post your other changes, curing bugs is what this forum's all about ;)

¥

9 May 16, 2007 14:22

¥åßßå wrote:

Glad it worked for you. The latest versions of the evocore require more memory than older versions ... mind you, they do a shedload more as well ;)

Memory is not a problem for me, I run my own server. But it could be for people renting their webspace.

Is 32 megs a good value for b2evo or should it be more?

¥åßßå wrote:

I'll have to look into the changes to make sure they're the best solution before I could say whether they'd get into the next version or not.

Well, I surly have no idea how other cellphones behave with these changes.

I hope the changes make it into the next version because I don't want to have a lot of work editing files after upgrading to a new version.

¥åßßå wrote:

Feel free to post your other changes, curing bugs is what this forum's all about ;)

Here you are:

Special character issue:

I took this out of [url=http://forums.b2evolution.net/viewtopic.php?p=14201]this thread[/url] in the German part of this form.

Bottom line is that you have to add two utf8 decoding lines to mms.php before the original code:

$post_title = utf8_decode( $post_title ); // decode to utf8
$post_title = format_to_post( trim( $post_title ), 0, 0 );

$content = utf8_decode( $content ); // decode to utf8
$content = format_to_post( trim( $content ), $Settings->get('AutoBR'), 0 );

All special characters like ä ö ü ß exept the Euro character € are shown now.

Text of MMS linked as image issue:

Out of the same thread like above. The text of the MMS was shown as text but also saved into the image directory and linked as image (which did not work, browser showed an error). Changes to mms.php:

$type = contentTypeToString( $part->contentType ); 
   if ( $ext != '.smil' && $ext != '.txt') // save and link as image if NOT .smil and .txt 
   { 
      $filename = 'mms' . mktime() . $ext;

Maybe I should have opened a new thread, but I hope this will be considered by the team as well.

Regards,
Roi

10 May 16, 2007 14:28

I've no idea what an ideal memory level is, I just took my server to one side and slapped it around until it agreed to just use whatever memory it needed ;)

I think they recomend 12meg on the manual, but don't quote me on that one.

I'll look into adding these changes as well, but I can't make promises for the next release.

¥

11 May 16, 2007 14:32

¥åßßå wrote:

I've no idea what an ideal memory level is, I just took my server to one side and slapped it around until it agreed to just use whatever memory it needed ;)

Hehe. ;)

¥åßßå wrote:

I think they recomend 12meg on the manual, but don't quote me on that one.

...which would be a lot too little because I now ran into problems with 16 megs.

¥åßßå wrote:

I'll look into adding these changes as well, but I can't make promises for the next release.

Great. Take your time. I'm leaving for a scube dive trip to Egypt this evening. B) So I won't notice a while... ;) The important thing is that this stuff makes it into the release sometime.

Regards,
Roi


Form is loading...