ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Issue with 32bit and 64bit
Posted by Mark on Mar-15-2012 11:05
Attachments:
Peter,

I have been preparing a 64bit gentoo server to replace the 32bit one using multilib and
Chartdirector. Attached are images from the 32bit server and the 64bit server.

Everything is manually compiled and have built PHP with -m32 (via export CFLAGS="-m32",
make.conf CFLAGS="-march=i686 -m32 -o2 -pipe").

Configured PHP the following way:
  ./configure --with-apxs2=/usr/local/httpd/bin/apxs  \\
   --with-mysql=/usr/local/bin --with-gd \\
   --with-config-file-path=/usr/lib32 --with-libdir=lib32

Also, note the "Change" (in arial font) link on the graphs, text missing on the new server,
cdinfo.php shows no issues. Also there are the color changes in the Charts. (Server Video
Driver?) Compiled MYSQL, Apache 2.2.8, and PHP 5.2.8 and pretty sure all the libs (like
libpng) in 32bit. Native CGI code and overall functions appear to work fine other than what
is noted.

Have been trying to figure it out and haven't any more ideas, have you?

Thanks,

Mark

PS. Charts are chopped for bandwidth (on Satellite)
32bit.png
64bit.png

  Re: Issue with 32bit and 64bit
Posted by Peter Kwan on Mar-16-2012 01:23
Hi Mark,

There is a 64-bit edition of ChartDirector for PHP for Linux. So instead of custom compile 32-bit PHP/Apache/MySQL and to use something like chroot to run the 32-bit binaries in a 64-bit Linux, you may consider to just use the Apache/PHP/MySQL that comes with your Linux distribution. This can confirm if ChartDirector is working the same way in the 32-bit server and the 64-bit server. In case it is working differently, we can use the same Linux distribution and the same PHP/Apache/MySQL binaries to test ourselves and diagnose the problem.

Also, for testing, you may consider to also try the sample code that comes with ChartDirector to see if you can get the same chart as the sample image included in the documentation. This can help to confirm if the issue is specific to your code, or affects all charting code in general.

For your case, to diagnose the problem, the first step is to make sure your code is exactly the same in both servers, and you are using exactly the same data. The latter part is hard to ensure if the data are dynamic (since even the database can work differently). So for testing, please try to use hard coded data for everything. For example, in case the text in the bottom right corner is generated dynamically, please hard coded it to see if it will appear. If the fonts or colors are not hard coded, please hard coded them too for the purpose of testing. Please try to hard coded it to a font and font size that works to see if the text can be displayed (such as the font you use on for x or y-axis labels).

Another possibility is due to some difference in the PHP. It is not uncommon to see PHP code that relies on undefined behaviour. An example is to use the text string "0xFFFF00" as a number. In some versions of PHP, "0xFFFF00" will be equivalent to 0xFF0000, while in some version it is equivalent to 0. (There is no PHP documentation that mentions how the text string "0xFFFF00" will be automatically converted to a number in numeric context, so the behaviour is undefined.) If such code are used, it is possible they have different meanings to different PHP interpreters, and so the output will look different.

Yet another possibility is that the custom compiled PHP is not binary compatible with the PHP distribution in most Linux. Like many open source projects, PHP compiled with different options may not be binary compatible with each others. The PHP extensions included in ChartDirector for PHP are designed to be compatible with the PHP that comes with virtually all Linux distributions, and is also compatible to PHP compiled using all default options (which should be 64-bit PHP in your case). However, there is always the possibility that it is not binary compatible with a custom compiled PHP. If this is the case, the system may behave unexpectedly.

If you need further help, may be you can provide a hard coded example and the resulting chart image. I will try to see if I can reproduce the problem.

Regards
Peter Kwan

  Re: Issue with 32bit and 64bit
Posted by Mark on Mar-16-2012 02:14
Attachments:
Peter,

I've included the complete images for the test between the 32 and 64bit versions (ie.
hardcoded).

Pie Chart with Legend (1) produces similar results but Pie Chart with Legend (2) produces
correct results both in color and text.

Aside from compiling PHP without gd (tried it)...Any ideas?

Thanks,

Mark
32bit.png
64bit.png

  Re: Issue with 32bit and 64bit
Posted by Mark on Mar-16-2012 02:17
Important:

Pie Chart with Legend (1) produces correct results, Pie Chart with Legend (2) does not.

  Re: Issue with 32bit and 64bit
Posted by Mark on Mar-16-2012 03:23
Peter,

Recompiled everything to 64bit using ChartDirector 64bit and the charts are fine. Was trying
to avoid Apache being 64bit for footprint reasons.

Thanks for your help,

Mark

ps. Still wonder what was the original issue...

  Re: Issue with 32bit and 64bit
Posted by Peter Kwan on Mar-17-2012 04:10
Hi Mark,

ChartDirector does not use the server's video driver, so any hardware difference should not cause the problem.

By guess is that the problem is related to how the PHP is compiled. May be the PHP compiled is not the same as a native 32-bit PHP. If you really want to use 32-bit PHP, I suggest you obtain the original pre-compiled PHP/Apache/MySQL that comes with 32-bit Gentoo, and use it on your 64-bit server.

In the charts that has issues, there are always some colors that are changed to semi-transparent white. In the charts in the sample code, the textbox color, title text color, and the border around the slices are all semi-transparent white. In your own charts, the missing text can be explained if it becomes semi-transparent white in a white background. Also, the grid lines and bar border becomes semi-transparent white.

In the original sample code, the colors that change to semi-transparent white are all "magic colors" represented by a number like 0xFF123456. The hex format of this number only exist in the PHP source code and only visible to the PHP interpreter. I suspect the PHP interpreter somehow parses it and change it to 2147483647 (equals to 0x7FFFFFFF semi-transparent white). 2147483647 is the largest positive 32-bit integer. PHP may have determined that 0xFF123456 is a positive integer but is too large to be fitted into 32-bit, it changes it to the largest possible integer 2147483647.

In my testing with my 32-bit PHP, the number 0xFF000000 is treated by PHP as 4278190080. Since it is not possible to have a 32-bit integer 4278190080, either the PHP internally is not using 32-bit to store an integer, or PHP treats 0xFF000000 as a floating point number. It is possible some PHP versions may treat 0xFF000000 as a negative integer. In all of these cases, it will not affect the operating of ChartDirector, as it is possible for ChartDirector to deduce what is the original number.

Regards
Peter Kwan