This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/includes/jpgraph/docs/chunkhtml/ch03s07.html
2011-05-28 19:51:52 +10:00

123 lines
13 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Troubleshooting the installation</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="ch03.html" title="Chapter 3. The Long Version: Installing the Library"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Troubleshooting the installation</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Chapter 3. The Long Version: Installing the Library</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="sect1" title="Troubleshooting the installation"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2492535"></a>Troubleshooting the installation</h2></div></div></div>
<p>Unfortunately there are many parameters in a server installation that may affect
the execution of PHP so the steps below can only give some indications of how to
further investigate some potential problems.</p>
<p>Experience shows that most of the trouble are caused by either an old buggy
version of the free-type TTF library or using an old antiquated version of the GD
library. So before starting trouble shooting the scripts please make sure that you
have an up to date PHP installation with the bundled version of the GD library (as
describe in the previous sections) and a working FreeType library installed.</p>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p><span class="bold"><strong>No image is displayed.</strong></span></p>
<p>The first thing you should do is to isolate the problem by calling
your graph script directly in the browser. There are then two variants
of this problem. </p>
<p>
</p><div class="orderedlist"><ol class="orderedlist" type="a"><li class="listitem">
<p>No data is sent back from the server.</p>
<p>You can verify this by calling your graph script directly
in the browser and then check the source (click "view
source" menu item in the browser). If this is a truly blank
image then no data was sent back from the browser.</p>
<p>This means that the PHP process has been terminated
prematurely before it could send any data back. This could
be caused by either the PHP process crashing (due to a bug
in either PHP or your HTTP server) or the HTTP server
crashed. This is often due to a broken PHP installation and
more than often a problem with the True Type libraries. </p>
<p>It could also be caused by the PHP script running longer
than the maximum allowed execution time (as specified in
<code class="filename">php.ini</code>). The first thing you
should do is to increase the maximum allowed execution time.
If this does not solve the problem you should look in the
log files for both your HTTP server and PHP to try to find
clues to if the PHP process really crashed. Another
possibility is that the PHP process uses more than the
maximum allowed memory (as set in
<code class="filename">php.ini</code>) and then it is terminated.
So a good first step is to put some really high values for
memory and time just to take away these parameters.</p>
</li><li class="listitem">
<p>The data sent back is corrupt.</p>
<p>Depending on your browser this can show up differently but
a common symptom is a "red X" in the browser. In order to
debug this you should make sure that you have followed the
steps in <a class="xref" href="ch03s03.html#sec2.config-dev-server" title="Configuring JpGraph/PHP on a development server">Configuring JpGraph/PHP on a development server</a> to make sure you
have output buffering disabled and have maximum error
checking enabled in PHP. The most common cases for this type
of problem is having enabled output buffering and some minor
errors in the script which causes PHP to emit warnings which
gets included in the image data. </p>
<p>A very common mistake is to have some white spaces in the
script before the opening "<code class="code">&lt;?php</code>". This
white space will be added to the output buffer and then get
mixed up with the image data causing the image data to be
corrupt. A similar problem can occur if multiple newlines
are added after the final <code class="code">"?&gt;"</code>
</p>
</li></ol></div><p>
</p>
</li><li class="listitem">
<p><span class="bold"><strong>An error message saying "Fonts are not available or not
readable" </strong></span></p>
<p>When an image contains TTF fonts you might get an error message saying
that the fonts are not available or not readable. If this is the case it
is first necessary to check that the font files really exist in the
directory that is specified in <code class="filename">jpg-config.inc.php</code>
and that they are also readable by the HTTP/PHP process. If this is the
case then it is necessary to check that the names of the font files are
the one that JpGraph assumes, see <a class="xref" href="ch03s02.html#sec3.name-of-ttf-files" title="Name of TTF font files">Name of TTF font files</a>. Another problem can be if
the PHP installation is running in "safe mode" (See <code class="uri"><a class="uri" href="http://se.php.net/manual/en/ini.sect.safe-mode.php" target="_top">PHP
Manual: Security and safe mode</a></code>) and has enabled strict
directory policy via an "<code class="code">open_basedir</code>" restriction. This
will prevent the PHP process from reading any files outside the
specified base directory. If this is enabled there is no way around for
PHP to read any files outside this restriction and any TTF files
necessary must be moved so that they can be accessed within the realms
of the specified basedirectory.</p>
<p>If you are running IIS and Win2k and get the error "Can't find font"
when trying to use TTF fonts then try to change the paths to UNIX style,
i.e. "<code class="filename">/usr/local/fonts/ttf/</code>". Remember that the
path is absolute and not relative to the <code class="filename">htdocs</code>
catalogue.</p>
<p>If you are running on Unix server please keep in mind that file names
are case sensitive.</p>
</li><li class="listitem">
<p><span class="bold"><strong>An error message saying "Headers have already been
sent"</strong></span></p>
<p>A common mistake is to have a space in the beginning of the image
script which the HTTP server will send back to the browser. The browser
now assumes that the data coming back from this script is text since it
hasn't received an explicit header. When then the image headers get sent
back to the browser to forewarn the browser of the forthcoming image
data the browser will not like that as it has already assumed the data
stream was a text stream. The browser will then give the infamous
"Headers already sent error".</p>
<p>Make sure that your script has no white space before the opening
"<code class="code">&lt;?php</code>" statement or a number of blank lines after
the concluding "<code class="code">?&gt;</code>"</p>
</li><li class="listitem">
<p><span class="bold"><strong>Issues specific to Windows and IIS</strong></span></p>
<p>Some windows installations seems to have a problem with a PHP script
ending in more than one newline (This newline seems to be sent to the
browser and will cause a <span class="italic">Header already sent error</span>). To correct this
problem check all your scripts for more than one empty newline after the
ending "<code class="code">?&gt;</code>" statement. All files provided with the library
end in exactly one final newline and should not be a problem.</p>
</li><li class="listitem">
<p><span class="bold"><strong>TTF fonts are not displayed correctly</strong></span></p>
<p>If the TTF fonts only shows up as yellow then the installation is used
a buggy (too old) installation of the FreeType font library and the only
thing to do is to re-install and setup PHP+GD again with a newer version
of the FreeType library. Another symptom of a an (old) buggy FreeType
library is that the fonts are not correctly rotated (the text string is
rotated but not the individual characters).</p>
</li></ol></div><p>As a final advise you should read the FAQ (available in this manual
see <a class="xref" href="apc.html" title="Appendix C. FAQ">Appendix C. <i>FAQ</i></a>) or on the JpGraph website at <code class="uri"><a class="uri" href="http://jpgraph.net/doc/faq.php" target="_top">http://jpgraph.net/doc/faq.php</a></code></p>
<p>Depending on your sever it might also help to recompile PHP yourself instead of
the version included with the system. You can find typical configuration scripts to
compile PHP4 and PHP5 in the appendices, see <a class="xref" href="api.html" title="Appendix I. Compiling PHP">Appendix I. <i>Compiling PHP</i></a>
</p>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>