A self-compiled php file cannot generate PNG images in linux.

Source: Internet
Author: User
The self-compiled php cannot generate a PNG image environment in linux:
CentOS 6.4 64-bit
Nginx 1.4.2
PHP 5.4.7
The GD library information is as follows:
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.11
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
LibJPEG Version 6b
PNG Support enabled
LibPNG Version 1.2.49
WBMP Support enabled
XPM Support enabled
XBM Support enabled

Directive Local Value Master Value
Gd.jpeg _ ignore_warning 0 0


This is the case now. I have a page for generating a verification code that uses a code written by someone else to generate the verification code. this code runs well on my local machine, when put on the server, there will be no output image data, and the image handle is ImagecreatetruecolorFunction generation. I use var_dump to print the crank and display the following information: resource (55) of type (gd)
Obviously, the handle is created. the generated code then calls these graphic functions:
Imagecolorallocate
Imagefilledrectangle
Imagettftext
Imageline

Last use
Header ('content-type: image/png ')
Cooperation
ImagepngFunction input verification code Image

Finally, I found through the browser-side debugger that, although it is of the image/png type, there is no valid data, that is, after the successful call ImagecreatetruecolorAfter the image handle is generated, other graphic functions do not write any graphic data to the image.

The problem now is that I must have the verification code generation function, including the verification code for the discuz Forum to be created later. how can I do this to make it work.
Due to the lack of freetype support in GD, I have re-compiled PHP. I can only 1 ). find out the cause of invalid input of the written image and solve the problem. 2 ). compile another version of PHP.
Please tell me how to change it.


Reply to discussion (solution)

Paste your code to verify that your program writing is correct
If you locate the problem among multiple identified factors, you should first use exclusion

Path, case ......

Have you solved the problem? I also encountered this problem, but I installed centos with yum. the gd Library is the same as yours.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.