Have you been able to check the web server error log? It's really the only
place to look when a script which returns an image (rather than HTML) gets an
error. I know you said "no error messages", but the PHP/web server errors have
to be going somewhere... WAMP is Apache on Windows, right? Then there should
be an apache.err file.
Failing that, is it possible to run the script from a command line? (I do that
to test PHPlot on Windows, using c:...\php.exe myscript.php > out.png) That
should report the errors to the window. Unfortunately the environment is
different (different User ID, for instance) so it is possible for a script to
run one way and not the other.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-03-22
No errors in the apache log. If I intentionally add an error to the php code I
do get error trapping in the PHP error log so I know the script is executing.
Also I do get the PHPlot test HTML output coming through in the window. For
the graph just a broken image icon.
I've tried to direct the output to a file with SetIsInline but it writes no
file. I suppose that's fair if there's an error in the generation.
I'll try the CLI method.
Thanks for the quick response.
Scot.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-03-22
When I run the CLI and open the PHP error log I get :
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1458
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1459
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1460
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1461
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1467
Five instances of the same error headers already sent by output.
It DOES write the PNG file although IrfanView. Will not open it due to header
errors. When I open the file with a HEX viewer I see there is 8k of
information but the start of the file contains the same error message as
above...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Something is being output before PHPlot gets to the headers. That could be an
error message, or it could be something else like a random "echo" or even a
space or newline when PHP is in 'copy' mode. Take another look in your hex
editor at the very start of the output. Is there anything at all before the
first: "PHP Warning"?
Even a single space or blank line will do it. For example, if your script
starts with a blank line or comment before the <?php open tag. In particular,
is there anything like that on line 4 of simpleplot.php?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-03-22
Oh wow. How strange.
There was only white space before the <?PHP tag.
I deleted to the top of the file and it worked!
Thanks for your help!
Scot.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, that will do it. Before the <?php tag, PHP is in "copy mode" and
literally copies everything. For a script that creates an image file, it is
bad news to have even a single space before that. If you do headers, you will
get the headers already sent warning, but even if you don't do headers the
output file will be a corrupt image file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-03-23
Interestingly enough if you have whitespace at the end of any of your
'included' files the output will also fail.
I'm going through all my code now to strip out whitespace!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Whitespace is only a problem at the end of included files (or the main script)
if you are putting the PHP end marker ?> at the end of the file. Any
whitespace after that will be copied. The best thing to do is just don't use
the end marker. Let the file end in PHP interpret mode and you won't have a
problem with white space at the end.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-03-23
Sheesh!
I see!
I always thought it was bad programming practice to leave out the end markers
for any scripting. Now I see everything has consequences!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-03-23
Very nice results. I now have three graphs on the same page with all the
trending information I need.
I liked it so much I fired off a donation!
Once again thanks for the great help.
Scot.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, thanks I guess, but I didn't know that worked, and I don't really know
what happens to any donations. I just checked the project settings.
Sourceforge says that all project admins need to opt in before donations are
accepted. I'm opted out, and Afan is opted in (he is the originally developer
of PHPlot and the copyright holder, but he turned the project over to me back
in 2008 and hasn't been active on it.) Since we are not both opted in, I
assumed the project would not take donations but apparently it does... The
donation paypal email address is on Afan's own domain. I guess I should look
into this and do something about it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-03-24
Well what do you know.
I found a bug! :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Maybe a bug. Sourceforge support says they are going to look into it. But it
might just be that he opted in and set up donations in 2003, way before I
joined up, and the system doesn't reset it when a new admin is added.
Sourceforge support also told me they "noted there was an attempted but
uncompleted donation today" (that was the 23rd). If you have any more
information about that, like if Sourceforge or paypal kicked it back with some
explanation that might be relevant to the project settings, please let me
know.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2010-03-24
Well mt PayPal says ....
You sent a payment of $20.00 USD to Afan Ottenheimer
so I guess if it didn't go to him it went somewhere.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using WAMP server v2.0 PHP 5.3.1 and when running the simple test outputs
I get just a broken image link in the browser.
I have tried different versions of PHP (5.3.0) and get the same results. No
error messages.
I have the php_gd2.dll GD2 library loaded from the php.ini file
(extension=php_gd2.dll).
I have checked everything I can think of checking with no luck. Any
suggestion?
Scot.
Have you been able to check the web server error log? It's really the only
place to look when a script which returns an image (rather than HTML) gets an
error. I know you said "no error messages", but the PHP/web server errors have
to be going somewhere... WAMP is Apache on Windows, right? Then there should
be an apache.err file.
Failing that, is it possible to run the script from a command line? (I do that
to test PHPlot on Windows, using c:...\php.exe myscript.php > out.png) That
should report the errors to the window. Unfortunately the environment is
different (different User ID, for instance) so it is possible for a script to
run one way and not the other.
No errors in the apache log. If I intentionally add an error to the php code I
do get error trapping in the PHP error log so I know the script is executing.
Also I do get the PHPlot test HTML output coming through in the window. For
the graph just a broken image icon.
I've tried to direct the output to a file with SetIsInline but it writes no
file. I suppose that's fair if there's an error in the generation.
I'll try the CLI method.
Thanks for the quick response.
Scot.
When I run the CLI and open the PHP error log I get :
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1458
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1459
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1460
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1461
PHP Warning: Cannot modify header information - headers already sent by
(output started at C:\wamp\www\physics\simpleplot.php:4) in
C:\wamp\www\physics\includes\phplot\phplot-5.1.0\phplot.php on line 1467
Five instances of the same error headers already sent by output.
It DOES write the PNG file although IrfanView. Will not open it due to header
errors. When I open the file with a HEX viewer I see there is 8k of
information but the start of the file contains the same error message as
above...
Something is being output before PHPlot gets to the headers. That could be an
error message, or it could be something else like a random "echo" or even a
space or newline when PHP is in 'copy' mode. Take another look in your hex
editor at the very start of the output. Is there anything at all before the
first: "PHP Warning"?
Even a single space or blank line will do it. For example, if your script
starts with a blank line or comment before the <?php open tag. In particular,
is there anything like that on line 4 of simpleplot.php?
Oh wow. How strange.
There was only white space before the <?PHP tag.
I deleted to the top of the file and it worked!
Thanks for your help!
Scot.
Yes, that will do it. Before the <?php tag, PHP is in "copy mode" and
literally copies everything. For a script that creates an image file, it is
bad news to have even a single space before that. If you do headers, you will
get the headers already sent warning, but even if you don't do headers the
output file will be a corrupt image file.
Interestingly enough if you have whitespace at the end of any of your
'included' files the output will also fail.
I'm going through all my code now to strip out whitespace!
Whitespace is only a problem at the end of included files (or the main script)
if you are putting the PHP end marker ?> at the end of the file. Any
whitespace after that will be copied. The best thing to do is just don't use
the end marker. Let the file end in PHP interpret mode and you won't have a
problem with white space at the end.
Sheesh!
I see!
I always thought it was bad programming practice to leave out the end markers
for any scripting. Now I see everything has consequences!
Very nice results. I now have three graphs on the same page with all the
trending information I need.
I liked it so much I fired off a donation!
Once again thanks for the great help.
Scot.
Well, thanks I guess, but I didn't know that worked, and I don't really know
what happens to any donations. I just checked the project settings.
Sourceforge says that all project admins need to opt in before donations are
accepted. I'm opted out, and Afan is opted in (he is the originally developer
of PHPlot and the copyright holder, but he turned the project over to me back
in 2008 and hasn't been active on it.) Since we are not both opted in, I
assumed the project would not take donations but apparently it does... The
donation paypal email address is on Afan's own domain. I guess I should look
into this and do something about it.
Well what do you know.
I found a bug! :)
Maybe a bug. Sourceforge support says they are going to look into it. But it
might just be that he opted in and set up donations in 2003, way before I
joined up, and the system doesn't reset it when a new admin is added.
Sourceforge support also told me they "noted there was an attempted but
uncompleted donation today" (that was the 23rd). If you have any more
information about that, like if Sourceforge or paypal kicked it back with some
explanation that might be relevant to the project settings, please let me
know.
Well mt PayPal says ....
You sent a payment of $20.00 USD to Afan Ottenheimer
so I guess if it didn't go to him it went somewhere.