After I tried phplot and really liked it, I included it on a site of mine. I
did it with the command.
I did it locally with xampp and everything works fine. I uploaded it to a
webserver and it works fine there. Now I uploaded it to another webserver,
where it's actually supposed to be, and it does not work there. The images
simply aren't shown, there's no error message or anything. I checked gd lib
and it's enabled, I checked the file permissions and they are set the same as
on the other webserver.
I am not a pro, and I can't figure out what the problem might be. Does anybody
know what I should check next? What might be missing or what preferences might
be missconfigured?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Testing locally is good. That will eliminate script syntax errors, for
example. (Make sure the uploaded script is the same - we had one case where
scripts were corrupted in uploading.)
If your script has no syntax errors, and PHPlot is able to create images, it
should produce an 'error image' (image with an error message) for anything
that goes wrong. As you are not getting an error image, there is something
more serious happening.
When your script is on the server and it doesn't work, you should first try to
check the web server error log. If the server is configured for display_errors
off (as production servers should), this is the only place the error will be
reported. Usually this will point you right to the problem. Unfortunately,
hosting providers don't always let you get to the error log.
If you can't get to the server error log (or the error log is no help), there
are other things you can try. Enter the URL directly to the image-generating
script (new_graph.php...), rather than the wrapper HTML page, in your browser.
If the script is returning text rather than an image, this will let you see
the text. If the server is configured to not return errors to the browser, try
putting "ini_set('display_errors', 1);" at the top of the script. Then browse
right to that script. This won't help if the error is before PHP finishes
parsing the whole script, but if you have something like an undefined function
or method this will show you.
If this is a host that you have not used for PHPlot before, do try a simple
test case first. An example is in the README.txt file, and in the manual ("A
Simple Graph"). If that doesn't work, you most likely have a problem with the
script finding phplot.php or the GD extension isn't working.
(I really need to collect these ideas and add a 'debugging' section in the
manual.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The upload should be fine since all other pages and the rest of the page
containing the image is working properly. But I will check that again to be
100% certain.
We have root access to the server, so getting the error_log shouldn't be a
problem. Therefor also, everything is configured and setup by ourselves.
There's a forum with image galleries etc on the server too, so I think the gd
lib is working as it's used for it as well.
I also tried browsing to new_graph.php directly. It gives me an empty page,
and when I check the page source code, it's simply blank. I tried the supplied
test html page, too. It shows the the title, but again no image.
Right now I don't have access to the server from where I am. But I will
retrieve the error_log tomorrow and continue searching for clues. I'm trying
some things on the other (test) webserver, but phplot works like a charm there
also it created some error_log output:
PHP Warning: max() : Array must contain at least one element in
/home3/clpiczag/public_html/DS/phplot.php on line 2508
PHP Fatal error: DrawGraph(): No data array in
/home3/clpiczag/public_html/DS/phplot.php on line 1666
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The second message (DrawGraph: No data array) happens if SetDataValues() was
never called, or the provided data array is empty. PHPlot should display an
error image in this case. It seems to do so, but I need to test this a little
more.
The first message - I would call that a bug. If you call SetDataValues($data)
with an empty array $data you will get that warning. I think the empty data
array condition was (and is) caught later, but using max() on the array was
probably something I added more recently, and it sort of breaks there. I'll
have to test that and fix it.
Bottom line, if this is what you are seeing, check to make sure your data
array actually does have row(s) of data.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are absolutely right, Ibayuk. I had a bug in my script that allowed the
new_graph.php to be called even if there's no player with that name. So of
course trying to get the data from the DB wouldn't work. An error image is
generated with "DrawGraph(): No data array". I fixed this now and so far
everything on my test server runs flawless.
Nevertheless, this won't be the problem on the "real" server.
Just FYI, some info about the server:
PHP Version 5.3.6
PHPLOT Version 5.3.1
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.7
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version 1.2.27
WBMP Support enabled
XPM Support enabled
XBM Support enabled
Let me know if there's anything else that could help.
Thank you very much again for your fast support.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After a simple restart of the server PHPLOT now works. We didn't change
anything. Stupid us not trying that earlier. Thanks a lot for your help
anyway, Ibayuk.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For the record, PHPlot should fail with an error image if there is no data
array, or if the data array is empty (no rows). It should produce an empty
graph, with no error, if there is a data array with one or more rows, but the
rows contain no valid data points. (Like this, for text-data type:
array(array('a', '')) - one row, one missing Y value.) While I'm not really
convinced this is the correct design, that's how it should work now.
It should not produce PHP errors in any case. You found one bug, and I found
one more so far, where there is a PHP error with an empty or malformed data
array. Those will be fixed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
After I tried phplot and really liked it, I included it on a site of mine. I
command.
did it with the
I did it locally with xampp and everything works fine. I uploaded it to a
webserver and it works fine there. Now I uploaded it to another webserver,
where it's actually supposed to be, and it does not work there. The images
simply aren't shown, there's no error message or anything. I checked gd lib
and it's enabled, I checked the file permissions and they are set the same as
on the other webserver.
I am not a pro, and I can't figure out what the problem might be. Does anybody
know what I should check next? What might be missing or what preferences might
be missconfigured?
Testing locally is good. That will eliminate script syntax errors, for
example. (Make sure the uploaded script is the same - we had one case where
scripts were corrupted in uploading.)
If your script has no syntax errors, and PHPlot is able to create images, it
should produce an 'error image' (image with an error message) for anything
that goes wrong. As you are not getting an error image, there is something
more serious happening.
When your script is on the server and it doesn't work, you should first try to
check the web server error log. If the server is configured for display_errors
off (as production servers should), this is the only place the error will be
reported. Usually this will point you right to the problem. Unfortunately,
hosting providers don't always let you get to the error log.
If you can't get to the server error log (or the error log is no help), there
are other things you can try. Enter the URL directly to the image-generating
script (new_graph.php...), rather than the wrapper HTML page, in your browser.
If the script is returning text rather than an image, this will let you see
the text. If the server is configured to not return errors to the browser, try
putting "ini_set('display_errors', 1);" at the top of the script. Then browse
right to that script. This won't help if the error is before PHP finishes
parsing the whole script, but if you have something like an undefined function
or method this will show you.
If this is a host that you have not used for PHPlot before, do try a simple
test case first. An example is in the README.txt file, and in the manual ("A
Simple Graph"). If that doesn't work, you most likely have a problem with the
script finding phplot.php or the GD extension isn't working.
(I really need to collect these ideas and add a 'debugging' section in the
manual.)
Hi lbayuk,
Thanks a lot for your help.
The upload should be fine since all other pages and the rest of the page
containing the image is working properly. But I will check that again to be
100% certain.
We have root access to the server, so getting the error_log shouldn't be a
problem. Therefor also, everything is configured and setup by ourselves.
There's a forum with image galleries etc on the server too, so I think the gd
lib is working as it's used for it as well.
I also tried browsing to new_graph.php directly. It gives me an empty page,
and when I check the page source code, it's simply blank. I tried the supplied
test html page, too. It shows the the title, but again no image.
Right now I don't have access to the server from where I am. But I will
retrieve the error_log tomorrow and continue searching for clues. I'm trying
some things on the other (test) webserver, but phplot works like a charm there
also it created some error_log output:
PHP Warning: max() : Array must contain at least one element in
/home3/clpiczag/public_html/DS/phplot.php on line 2508
PHP Fatal error: DrawGraph(): No data array in
/home3/clpiczag/public_html/DS/phplot.php on line 1666
The second message (DrawGraph: No data array) happens if SetDataValues() was
never called, or the provided data array is empty. PHPlot should display an
error image in this case. It seems to do so, but I need to test this a little
more.
The first message - I would call that a bug. If you call SetDataValues($data)
with an empty array $data you will get that warning. I think the empty data
array condition was (and is) caught later, but using max() on the array was
probably something I added more recently, and it sort of breaks there. I'll
have to test that and fix it.
Bottom line, if this is what you are seeing, check to make sure your data
array actually does have row(s) of data.
You are absolutely right, Ibayuk. I had a bug in my script that allowed the
new_graph.php to be called even if there's no player with that name. So of
course trying to get the data from the DB wouldn't work. An error image is
generated with "DrawGraph(): No data array". I fixed this now and so far
everything on my test server runs flawless.
Nevertheless, this won't be the problem on the "real" server.
Just FYI, some info about the server:
PHP Version 5.3.6
PHPLOT Version 5.3.1
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.7
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version 1.2.27
WBMP Support enabled
XPM Support enabled
XBM Support enabled
Let me know if there's anything else that could help.
Thank you very much again for your fast support.
It works now.
After a simple restart of the server PHPLOT now works. We didn't change
anything. Stupid us not trying that earlier. Thanks a lot for your help
anyway, Ibayuk.
OK, glad it works now even if we don't know why.
For the record, PHPlot should fail with an error image if there is no data
array, or if the data array is empty (no rows). It should produce an empty
graph, with no error, if there is a data array with one or more rows, but the
rows contain no valid data points. (Like this, for text-data type:
array(array('a', '')) - one row, one missing Y value.) While I'm not really
convinced this is the correct design, that's how it should work now.
It should not produce PHP errors in any case. You found one bug, and I found
one more so far, where there is a PHP error with an empty or malformed data
array. Those will be fixed.