fest
fest

Reputation: 1635

PHP outputs question marks

I'm deploying an application on a server in Japan. The application is a product which my company is selling, and it's been successfully installed on many other servers without such problems. The application is written in PHP/CodeIgniter, and the same package was successfully tested on other servers.

The problem is- the application only shows some question marks (and then it dies with an error, that a certain class is not found, although the same code works on other server). Some application files are encoded with Zend Guard- Zend Optimizer is available on both servers. What I have tried/found out: 1) Major PHP version on both servers is the same- 5.2.x

2) Zend Optimizer versions are the same- 3.3.9

3) The question marks are in fact question marks- piped the output to file with wget and opened it in HEX editor- the file mostly contains 3F, with some random HEX symbols between:

0000000: 3f3f 3f3f 3f3f 3f3f 3f3f 3f01 3f3f 3f3f  ???????????.????
0000010: 3f3f 3f3f 3f3f 3f3f 3f3f 203f 3f3f 3f3f  ?????????? ?????
0000020: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000030: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000040: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000050: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000060: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000070: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000080: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000090: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
00000a0: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
00000b0: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
00000c0: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
00000d0: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
00000e0: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
00000f0: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000100: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000110: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000120: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????
0000130: 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f 3f3f  ????????????????

4) Application dies at a point, where no output should have been sent yet.

5) I suspect, that the problem is related to PHP settings- so far, I have tried setting default_charset to 'utf-8' in php.ini, but that does not change anything.

6) Expected output to the point where application crashes should be nothing- no output at all. Instead, I get the output above (it continues on in that manner).

EDIT: I guess I am getting somewhere- the problem is with Zend Optimizer. Replacing the encoded files helped, and the output is as expected. This creates another problem- how to tell what's wrong with Zend Optimizer? The encoded files were tested on different server with the same version of Zend Optimizer, and they run fine. PHP versions are 5.2.14 on the server which works, vs 5.2.13 on the server where the encoded files do not work.

Upvotes: 2

Views: 1166

Answers (2)

fest
fest

Reputation: 1635

php.ini:

zend_optimizer.enable_loader=0

The error was cryptic enough though...

Upvotes: 1

Patrick
Patrick

Reputation: 1827

Go to the first line of the file in question and add echo 'flag1';. Go to the first include() and add echo 'flag2'; after it. Continue for every include() and one more at the end of the file. This will tell you where the question marks are starting and you can move them around until you find the exact source.

If this process leads you into the CodeIgniter libraries, then it could be a bug in their code and you'd have to bring it up with them.

Upvotes: 1

Related Questions