★1. Allowed memory size of 8388608 bytes exhausted

pecl install imagick

と打ったら

[root@localhost ~]# pecl install imagick
downloading imagick-2.1.1.tgz ...
Starting to download imagick-2.1.1.tgz (74,980 bytes)
.................done: 74,980 bytes

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 536342 bytes) in /usr/share/pear/PEAR/Task/Replace.php on line 177

とかえってきました。

 こういうエラーってエラー内容をそのまま検索すると意外と出てくるものですが、案の定、ありました。

php.iniのmemory_limitを増やしても、peclの実行でmemory exhaustedが発生してしまう時の対処法 - Connect, Automate, Speed Up, Make Happy
http://d.hatena.ne.jp/snegishi/20071212/1197422664

 記事の中では、/usr/share/php/pearcmd.php@ini_set('memory_limit', '16M');を追加すると書いてありましたが、私の環境(CentOS 5.1、yum経由でphp・pearインストール済み)では/usr/share/pear/pearcmd.phpにありました。元の記事はUbuntuだったのでまぁ誤差の範囲内ですかね。

 pearcmd.phpの冒頭45行目くらいに@ini_setの連続があったのでそこに追加しました。下のような感じ。


<?php

 

ob_implicit_flush(true);

@ini_set(‘track_errors’true);

@ini_set(‘html_errors’false);

@ini_set(‘magic_quotes_runtime’false);

@ini_set(‘memory_limit’‘16M’); // ここに追加

$_PEAR_PHPDIR ‘#$%^&*’;

set_error_handler(‘error_handler’);
?>

★2. phpize: command not found

 もう一度挑戦

[root@localhost ~]# pecl install imagick
downloading imagick-2.1.1.tgz ...
Starting to download imagick-2.1.1.tgz (74,980 bytes)
.................done: 74,980 bytes
5 source files, building
running: phpize
sh: phpize: command not found
ERROR: `phpize' failed

 はい失敗。phpizeがないって。インストールの仕方を調べても、あんまり出てこなかったけれども、php-develパッケージをインストールするとphpizeがついて来るそうなので、yumでインストール。

yum -y install php-devel

 依存関係でautomakeもインストールされましたと。

Installed: php-devel.i386 0:5.1.6-15.el5
Dependency Installed: automake.noarch 0:1.9.6-2.1
Complete!

 これでphpizeは使えるようになったかな。

?★3. ImageMagickのインストール

 さらにもう一度挑戦

[root@localhost ~]# pecl install imagick
downloading imagick-2.1.1.tgz ...
Starting to download imagick-2.1.1.tgz (74,980 bytes)
.................done: 74,980 bytes
5 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20050922
Zend Extension Api No:   220051025
1. Please provide the prefix of Imagemagick installation : autodetect

1-1, 'all', 'abort', or Enter to continue: [Enter]#[Enter]キーを押して続行
building in /var/tmp/pear-build-root/imagick-2.1.1
running: /tmp/pear/temp/imagick/configure --with-imagick
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc and cc understand -c and -o together... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-redhat-linux-gnu
checking host system type... i686-redhat-linux-gnu
checking target system type... i686-redhat-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext
checking for PHP extension directory... /usr/lib/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking for re2c... no
configure: WARNING: You will need re2c 0.9.11 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable the imagick extension... yes, shared
checking whether to enable the imagick GraphicsMagick backend... no
checking ImageMagick MagickWand API configuration program... configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
ERROR: `/tmp/pear/temp/imagick/configure --with-imagick' failed

 なんとなく、ImageMagickがインストールしてないためのエラーな気がします。よって、インストール。

yum -y install ImageMagick-devel

?

Installed: ImageMagick-devel.i386 0:6.2.8.0-3.el5.4
Dependency Installed: ImageMagick.i386 0:6.2.8.0-3.el5.4 alsa-lib.i386 0:1.0.14-1.rc4.el5 audiofile.i386 1:0.2.6-5 avahi.i386 0:0.6.16-1.el5 avahi-glib.i386 0:0.6.16-1.el5 bzip2-devel.i386 0:1.0.3-3 esound.i386 1:0.2.36-3 gamin.i386 0:0.1.7-8.el5 gd.i386 0:2.0.33-9.4.el5_1.1 ghostscript.i386 0:8.15.2-9.1.el5_1.1 ghostscript-devel.i386 0:8.15.2-9.1.el5_1.1 ghostscript-fonts.noarch 0:5.50-13.1.1 gnome-keyring.i386 0:0.6.0-1.fc6 gnome-mime-data.i386 0:2.4.2-3.1 gnome-mount.i386 0:0.5-3.el5 gnome-vfs2.i386 0:2.16.2-4.el5 lcms.i386 0:1.15-1.2.2 lcms-devel.i386 0:1.15-1.2.2 libICE-devel.i386 0:1.0.1-2.1 libSM-devel.i386 0:1.0.1-3.1 libX11-devel.i386 0:1.0.3-8.0.1.el5 libXau-devel.i386 0:1.0.1-3.1 libXdmcp-devel.i386 0:1.0.1-2.1 libXext-devel.i386 0:1.0.1-2.1 libXt-devel.i386 0:1.0.2-3.1.fc6 libart_lgpl.i386 0:2.3.17-4 libbonobo.i386 0:2.16.0-1.fc6 libbonoboui.i386 0:2.16.0-1.fc6 libcroco.i386 0:0.6.1-2.1 libdaemon.i386 0:0.10-5.el5 libglade2.i386 0:2.6.0-2 libgnome.i386 0:2.16.0-6.el5 libgnomecanvas.i386 0:2.14.0-4.1 libgnomeui.i386 0:2.16.0-5.el5 libgsf.i386 0:1.14.1-6.1 libjpeg-devel.i386 0:6b-37 librsvg2.i386 0:2.16.1-1.el5 libtiff-devel.i386 0:3.8.2-7.el5 libwmf.i386 0:0.2.8.4-10.1 mesa-libGL-devel.i386 0:6.5.1-7.5.el5 shared-mime-info.i386 0:0.19-3.el5 urw-fonts.noarch 0:2.3-6.1.1 xorg-x11-proto-devel.i386 0:7.1-9.el5.centos
Complete!

?

★4. pecl install imagick

 さらにさらにもう一度挑戦

[root@localhost ~]# pecl install imagick
downloading imagick-2.1.1.tgz ...
Starting to download imagick-2.1.1.tgz (74,980 bytes)
.................done: 74,980 bytes
5 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20050922
Zend Extension Api No:   220051025
1. Please provide the prefix of Imagemagick installation : autodetect

1-1, 'all', 'abort', or Enter to continue: [Enter]#[Enter]キーを押して続行
building in /var/tmp/pear-build-root/imagick-2.1.1
running: /tmp/pear/temp/imagick/configure --with-imagick
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
#======= 省略 =======
Build process completed successfully
Installing '/usr/lib/php/modules/imagick.so'
install ok: channel://pecl.php.net/imagick-2.1.1
configuration option "php_ini" is not set to php.ini location
You should add "extension=imagick.so" to php.ini

 うまくいったみたいです。最後に、php.iniに”extension=imagick.so”を加えれば完了なのかな?

 

原文轉貼至: http://labs.uechoco.com/blog/2008/04/phppecl.html 

 


arrow
arrow
    全站熱搜

    Frank 發表在 痞客邦 留言(0) 人氣()