Page 1 of 1

PHP script fills browser with question marks

PostPosted: 31. January 2009 14:30
by naudefj
I've successfully installed the FUDforum software with XAMP 1.7.0 on Windows, however, when I try the same on XAMPP 1.7.0 for Linux, the browser window just fills with question marks.

There are no PHP errors and "php -l install.php" returns "No syntax errors detected".

Any suggestions on where to start looking for the problem?

Best regards.

Frank

Re: PHP script fills browser with question marks

PostPosted: 31. January 2009 19:24
by Wiedmann
Any suggestions on where to start looking for the problem?

Ask the FUDforum support?

Re: PHP script fills browser with question marks

PostPosted: 31. January 2009 19:41
by naudefj
Well, the same script is working on XAMP for Windows, so I reckon the problem is with the Linux port of XAMP.

PS: I'm not the only one with this problem. Here's a similar discussion (without resolution) on the FUDforum site - http://fudforum.org/forum/index.php?&t=msg&th=4633

Best regards.

Frank

Re: PHP script fills browser with question marks

PostPosted: 31. January 2009 19:52
by Wiedmann
so I reckon the problem is with the Linux port of XAMP.

Only a FUDforum developer can told you, in which case the script is just outputting "?????".

(Or someone other who is looking through the code.)

Re: PHP script fills browser with question marks

PostPosted: 31. January 2009 20:41
by naudefj
The question marks are not in the script.

I've just installed php separately on the same system, and it worked perfectly. So, XAMP on Windows is good and PHP 5.2.6 stand-alone is good. I even have it working on a server with PHP 5.1.6. The exception is XAMP for Linux!

Re: PHP script fills browser with question marks

PostPosted: 01. February 2009 07:36
by naudefj
OK, here is a small test case to simulate the problem:
Code: Select all
<?php
/* �[34m^G~Nظ^@~P~N�^@^A)�)����[34m^Y^@^@
 * First 20 bytes of linux 2.4.18, so various windows utils think
 * this is a binary file and don't apply CR/LF logic
 */
echo "Hello world\n";
?>


Working with normal PHP:
Code: Select all
# /usr/bin/php x.php
Hello world


Broken with XAMPP for Linux's PHP:
Code: Select all
# /opt/lampp/bin/php x.php
??????�???????????????????????????????????????????????????????????????????????????????????

Re: PHP script fills browser with question marks

PostPosted: 01. February 2009 12:03
by Wiedmann
Well, I don't know why there is a difference behavior with XAMPP, but the problem is this curious 1st line in the remark.
--> Thus, just remove this line, an the script should also work with XAMPP.

Re: PHP script fills browser with question marks

PostPosted: 01. February 2009 14:35
by naudefj
It's not that easy, the script contains more binary data (the files that must be extracted) below the following section:

Code: Select all
<?php exit; ?>
<?php __HALT_COMPILER(); ?


This is all valid PHP code. It's strange that XAMP for Linus chokes on it, while all other PHP installations (including XAMP for Windows) works just fine. I would appreciate if a bug can be opened for it.

Re: PHP script fills browser with question marks

PostPosted: 01. February 2009 15:52
by Oswald
Hi Frank!

Can you please send me the PHP file in an email to oswald@apachefriends.org.

Greetings
Oswald

Re: PHP script fills browser with question marks

PostPosted: 02. February 2009 16:40
by Oswald
Hi Frank!

Thanks for the file. It's because of a NULL character (shown as ^@) in the PHP code.

I assume(!) it's a problem with PHP mbstring extension for multi-byte string support. Sadly in XAMPP for Linux this extension is compiled in and can't be disabled. But - as far as I know - on Windows you may disable this extension. @Wiedmann: Do you know if it's a shared extension in XAMPP for Windows?

Greetings
Oswald

Re: PHP script fills browser with question marks

PostPosted: 02. February 2009 16:58
by naudefj
Good spot! What's strange is that the NULL doesn't even have to be in the PHP code. This example gives the same error:

Code: Select all
<?php echo "Hi"; ?>
/* ^@ */

Re: PHP script fills browser with question marks

PostPosted: 02. February 2009 17:03
by Oswald
Hi Frank!

Yes, it IS strange.

And I just found that Sun's Cool Stack has the same problem: http://forums.sun.com/thread.jspa?threadID=5305046 But according to them it's not an mutibytestring issue.

Greetings
Oswald

Re: PHP script fills browser with question marks

PostPosted: 02. February 2009 17:42
by Wiedmann
@Wiedmann: Do you know if it's a shared extension in XAMPP for Windows?

"mbstring" is a shared extension, and it's enabled in "XAMPP for Windows".

Re: PHP script fills browser with question marks

PostPosted: 09. February 2009 15:56
by naudefj
I hope you guys be able to fix this problem in a subsequent release. XAMPP is a great distributions and I would love to use it on Linux as well.

Re: PHP script fills browser with question marks

PostPosted: 09. May 2009 07:19
by naudefj
The solution to this problem is to edit your php.ini file and set detect_unicode to Off.

Fore more details, see http://bugs.php.net/bug.php?id=36711