gpt4 book ai didi

php imagepng() gdb调试信息

转载 作者:太空宇宙 更新时间:2023-11-04 12:13:33 25 4
gpt4 key购买 nike

$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);

当你执行这段代码时,Apache 会崩溃,我使用 gdb 调试 coredump 如下:

$gdb /usr/sbin/httpd /var/apachecoredumps/core.12029
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/httpd...Reading symbols from /usr/sbin/httpd...(no debugging symbols found)...done.
(no debugging symbols found)...done.
[New LWP 12029]
[New LWP 12046]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/sbin/httpd -DFOREGROUND'.
Program terminated with signal 11, Segmentation fault.
0 0x00007f2cd96bafe9 in fill_window () from /lib64/libz.so.1
Missing separate debuginfos, use: debuginfo-install httpd-2.4.6-67.el7.centos.6.x86_64
(gdb) where
0 0x00007f2cd96bafe9 in fill_window () from /lib64/libz.so.1
1 0x00007f2cd96bb5f0 in deflate_slow () from /lib64/libz.so.1
2 0x00007f2cd96bc684 in deflate () from /lib64/libz.so.1
3 0x00007f2cb81c9dfa in png_write_find_filter () from /lib64/libpng15.so.15
4 0x00007f2cb81c4f95 in png_write_row () from /lib64/libpng15.so.15
5 0x00007f2cb81c51db in png_write_image () from /lib64/libpng15.so.15
6 0x00007f2cb8bab2ff in _gdImagePngCtxEx () from /lib64/libgd.so.3
7 0x00007f2cb8dfe149 in _php_image_output_ctx.isra.16 () from /usr/lib64/php/modules/gd.so
8 0x00007f2cbc0a45c5 in xdebug_execute_internal () from /usr/lib64/php/modules/xdebug.so
9 0x00007f2cd172e504 in zend_do_fcall_common_helper_SPEC () from /etc/httpd/modules/libphp5.so
10 0x00007f2cd16c2808 in execute_ex () from /etc/httpd/modules/libphp5.so
11 0x00007f2cbc0a3a58 in xdebug_execute_ex () from /usr/lib64/php/modules/xdebug.so
12 0x00007f2cd16870eb in zend_execute_scripts () from /etc/httpd/modules/libphp5.so
13 0x00007f2cd1621da2 in php_execute_script () from /etc/httpd/modules/libphp5.so
14 0x00007f2cd173012d in php_handler () from /etc/httpd/modules/libphp5.so
15 0x0000558429d3da40 in ap_run_handler ()
16 0x0000558429d3df89 in ap_invoke_handler ()
17 0x0000558429d52b0a in ap_process_async_request ()
18 0x0000558429d52de4 in ap_process_request ()
19 0x0000558429d4efe2 in ap_process_http_connection ()
20 0x0000558429d47040 in ap_run_process_connection ()
21 0x00007f2cd499880f in child_main () from /etc/httpd/modules/mod_mpm_prefork.so
22 0x00007f2cd4998a55 in make_child () from /etc/httpd/modules/mod_mpm_prefork.so
23 0x00007f2cd49996ee in prefork_run () from /etc/httpd/modules/mod_mpm_prefork.so
24 0x0000558429d2215e in ap_run_mpm ()
25 0x0000558429d1aed6 in main ()

有什么问题?

最佳答案

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

Program terminated with signal 11, Segmentation fault. 0 0x00007f2cd96bafe9 in fill_window () from /lib64/libz.so.1

在这种情况下,您需要 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);
?>

关于php imagepng() gdb调试信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48107751/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com