[Lazarus] Error 500

Michael Van Canneyt michael at freepascal.org
Wed Apr 6 00:11:24 CEST 2011



On Tue, 5 Apr 2011, Mattias Gaertner wrote:

> On Tue, 5 Apr 2011 12:14:58 -0300
> silvioprog <silvioprog at gmail.com> wrote:
>
>> 2011/4/5 silvioprog <silvioprog at gmail.com>:
>>> Hi.
>>>
>>> In a simple CGI app, I try to use TFreeTypeFont class, but without success.
>>> The error returned is "Error 500"(see log in [1]).
>>>
>>> In attached I send a small sample to reproduce the error.
>>>
>>> *Lazarus 0.9.31 r30005 FPC 2.5.1 i386-win32-win32/win64 / XAMPP 1.7.3!
>>> on Windows Seven 64.*
>>>
>>> Thx.
>>>
>>> [1]:
>>> ---------------------------
>>> Date: Tue, 05 Apr 2011 14:54:11 GMT
>>> Server: Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l
>>> mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4
>>> Perl/v5.10.1
>>> Vary: accept-language,accept-charset
>>> Accept-Ranges: bytes
>>> Connection: close
>>> Content-Type: text/html; charset=iso-8859-1
>>> Content-Language: pt-br
>>> ---------------------------
>>>
>>> 500 Internal Server Error
>>
>> I'm trying to write a text in an image and show in the browser. This
>> code[1] not works (returns error 500).
>
> Look into your apache logs for more details.
>
>
>> [1] (http://www.mail-archive.com/lazarus@lists.lazarus.freepascal.org/msg18488/t.pp):
>> uses
>>   FPCanvas, FPImage, FPImgCanv, FTFont, FPWritePNG;
>>
>> var
>>   img: TFPMemoryImage;
>>   c: TFPImageCanvas;
>>   f: TFreeTypeFont;
>> begin
>>   img := TFPMemoryImage.Create(500, 100);
>>   c := TFPImageCanvas.Create(img);
>>   f := TFreeTypeFont.Create;
>>   c.Clear;
>>   c.Pen.FPColor := colRed;
>>   f.Name := 'Times';

Where do you load the font path ?
I miss things like

   ftFont.InitEngine;
   FontMgr.SearchPath:='/usr/lib/X11/fonts/truetype';

or on windows

   FontMgr.SearchPath:='c\windows\fonts';


>>   f.Size := 14;
>>   f.FPColor := colRed;
>>   c.Font := f;
>>   c.TextOut(10, 20, 'sample text 12345');
>>   img.SaveToFile('test.png');
>
> Has the cgi script write permissions when running as apache user?

It is on windows, so it should be OK.

Michael.




More information about the Lazarus mailing list