php imagepng()gdb调试信息

时间:2018-01-05 05:35:41

标签: php linux apache gdb

handlebars.registerHelper("ifgt", new Helper<Integer>() {
            @Override
            public CharSequence apply(Integer value, Options options) throws IOException {
                if (value == null || options.param(0) == null) return options.inverse();
                if (value.compareTo(options.param(0)) > 0) {
                    return options.fn();
                }
                return options.inverse();
            }
        });

执行此代码时Apache会崩溃,我使用gdb调试coredump,如下所示:

$img   = imagecreate(110, 20) or die("error!");
$bg    = imagecolorallocate($img, 255, 255, 255);
$text_color = imagecolorallocate($img, 55, 55, 55);
imagestring($img, 5, 0, 3, "leo", $text_color);

imagepng($img);
imagedestroy($img);

问题是什么?

2 个答案:

答案 0 :(得分:0)

您需要配置apache httpd.conf,并启用(也可能安装)所需的软件包,例如:

  

程序因信号11,分段故障而终止。   来自/lib64/libz.so.1的fill_window()中的0 0x00007f2cd96bafe9

在这种情况下,你需要libz。

我建议也更新到php7。

之后使用此代码:

<?php
header ("Content-type: image/png");
$img = @ImageCreate (110, 20)
      or die ("error!");
$bg = ImageColorAllocate ($img, 255, 255, 255);
$text_color = ImageColorAllocate ($img, 55, 55, 55);
ImageString ($img, 5, 0, 3, "leo", $text_color);
ImagePNG ($img);
imageDestroy($img);
?> 

答案 1 :(得分:0)

  

有什么问题?

您没有安装调试信息,这就是gdb在这一行中所说的内容:

Reading symbols from /usr/sbin/httpd...Reading symbols from /usr/sbin/httpd...(no debugging symbols found)...done.

要获取bt输出中的行号,您应该安装调试信息,请参阅gdb输出中的另一行:

Missing separate debuginfos, use: debuginfo-install httpd-2.4.6-67.el7.centos.6.x86_64

另请注意,您可能需要使用类似命令为libz和libpng库安装调试信息。

相关问题