Home >Backend Development >PHP Tutorial >A few tips on PHP jpgraph (with installation method), jpgraph installation method_PHP tutorial
The GD library in PHP itself is a very powerful drawing library, and the images drawn are basically It can meet daily requirements, but it is powerful and powerful, but it is not convenient enough, because the powerful and convenient jpgraph based on PHP's GD library was born!
PHP does not enable the GD library by default because the extension=php_gd2.dll comment needs to be turned on in the php.ini configuration file. After opening it, you can draw some weird patterns you want to draw. What? Can't draw? Then go back and learn the basics!
Today I watched a video from a training institution and the jpgraph report. Following the video method, I downloaded Version: 3.0.7 version, create a jpgraph directory in the Examples directory after decompression, and cut all files in the src directory except Examples to the newly created jpgraph directory in the Examples directory. Then copy Examples to the directory configured by apache.
But after trying for a long time, I kept getting an error message:
Warning: strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in H:TestFileExamplesjpgraphjpgraph.php on line 391
JpGraph Error: HTTP headers have already been sent.
Caused by output from file jpgraph.php at line 392.Explanation :
HTTP
headers have already been sent back to the browser indicating the data
as text before the library got a chance to send it's image HTTP header
to this browser. This makes it impossible for the library to send back
image data to the browser (since that would be interpreted as text by
the browser and show up as junk text).
Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.
For example it is a common mistake to leave a blank line before the opening "".
After reporting a bunch of Warnings above, an error appeared: JpGraph Error. So, the blogger who was not good at English simply sent this pile of English to Baidu Translate. I still didn’t understand it, so I looked for it online. No one answered Dui, so I found it after searching on Google. http://bbs.php100.com/simple/?t294044.html, the answer is probably about the time zone, and the solution is also given. Just use date_default_timezone_set('Asia/Chongqing'); to set the corresponding time zone, here It is set to Chongqing. The problem will be solved accordingly.
Then I downloaded jpgraph of Version: 3.5.0b1 and tried it in the same way. The picture on the homepage still cannot be loaded. The reason is that there is no 'jpgraph/jpgraph_odo.php' file, resulting in There was a problem when it was introduced, and the blogger searched the Internet for the corresponding files and copied them to the jpgraph directory, but still could not solve it, and finally let it go.
Is there any solution?