最近在使用 phpthumb 時遇到這個問題,錯誤訊息長這樣

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 16608 bytes) in /home/yo/work/libs/extlibs/phpthumb/GdThumb.inc.php on line 111

不管進 /etc/php.ini 調整 memory_limit = 256M 重開 server,還是在程式裡加上 ini_set('memory_limit', '256M'); 都一直噴這個訊息

辜狗了一下,很多人說要調整 suhosin.memory_limit 這個參數,再辜狗了一下 suhosin 是啥,原來是個 php 套件,接著找到了這個指令

yum install php-suhosin

執行了之後卻出現

No package php-suhosin available.

只好再辜狗,才知道要先更新 yum, http://stackoverflow.com/questions/17109818/install-php-mcrypt-on-centos6

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

yum update

sudo yum install php-suhosin

這樣就可以把 suhosin 裝起來了

 

接下來只要再進 /etc/php.ini 調整 memory_limit = 256M 然後重開 server,或是在程式裡加上 ini_set('memory_limit', '256M'); 就可以了

似乎不需要動到 /etc/php.d/suhosin.ini 的 suhosin.memory_limit = 0 這個預設值

arrow
arrow
    全站熱搜

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