- [Show pagesource]
- [Old revisions]
- [[unknown link type]]
- []
Table of Contents
http://www.php.net/releases/ http://pecl.php.net/package/imagick/
Building extra php version 5.0.4 with mysql, libpdf and imagick
Story
Some private company I work for have an expensive licence (EUR 800) for libpdf 6.0.4 working only with php 5.0.3 (according to documentation). Because it is compiled against PHP_API 20041030 otherwise throws this error:
Module compiled with module API=20041030, debug=0, thread-safety=0
PHP 5.0.4 works also fine.
So I've decided to register another suffix to compile <whatever>.phppdf with php running as cgi /usr/lib/cgi-bin/php-cgi-5.0.4
.
Download
- ImageMagick-6.2.9 ftp://ftp.nluug.nl/pub/ImageMagick/
- php 5.0.4 http://www.php.net/releases/
- imagick 0.9.13 http://pecl.php.net/package/imagick/
Compiling it all together
Compiling ImageMagick
wget ftp://ftp.nluug.nl/pub/ImageMagick/ImageMagick-6.2.9-8.tar.bz2 tar -xjf ImageMagick-6.2.9-8.tar.bz2 cd ImageMagick-6.2.9 ./configure --with-x make make install
note: That –with-x
must be there, because imagick.c (imagick.h to be precise) defines structure
imagick_t with draw_context variable. This item's type depends on version. Once it is
DrawContext and then it is DrawingWand*.
note: Or you can change the type between this two
DrawingWand* draw_context ; /*new api */ DrawContext draw_context ;
note: If you run into compiling problems with strcpy or atexit, this is because of gcc 4.3. It is the new gcc's design/api problem, nothing serious.
shit:
Magick++/lib/Image.cpp:3915: error: 'atexit' was not declared in this scope
add this line
fix:
#include <cstdlib>
Adding imagick into PHP's tree
tar -xzf php-5.0.4.tar.gz cd php-5.0.4/ext wget http://pecl.php.net/get/imagick-0.9.13.tgz tar -xzf imagick-0.9.13.tgz mv imagick-0.9.13 imagick
Compiling PHP
rm configure ./buildconf --force Here you can check "./configure --help" if it hase --with-imagick option ./configure --with-imagick --with-mysql make
Extracting the php-cgi binary
cp php-5.0.4/sapi/cgi/php /usr/lib/cgi-bin/php-cgi-5.0.4
And Apache
So here is a short debian oriented how-to register new .phppdf suffix to get compiled by /usr/lib/cgi-bin/php-cgi-5.0.4.
- a2enmod action
- mod-available/phppdf.conf
AddHandler php-script .phppdf .phppdf Action php-script /cgi-bin/php-cgi-5.0.4
- ln -s sites-available/phppdf.conf sites-enabled/phppdf.conf
- /etc/init.d/apache2 restart
That's all!