PHP 5.4.12 Mac OSX imagecreate* functions not working

I am running PHP 5.4.12 from macports on Mac OSX 10.7.5 with Apache 2 (Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/1.0.1e DAV/2 PHP/5.4.12). 5 days ago this code worked (yes directly from PHP site):

<?php
header ('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
      or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im); 
?>

I closed my laptop. Then opened it 3 days later, went to my test page with this code, and it no longer worked but I get no errors. I see the broken image image instead of the generated image. I upgraded all my software and libs today. This is what phpinfo says about GD Lib:

GD Support  enabled
GD Version  bundled (2.0.34 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.4.10
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version unknown
PNG Support enabled
libPNG Version  1.5.14
WBMP Support    enabled
XBM Support enabled

phpinfo() reports this about my php install:

'./configure' '--prefix=/opt/local' '--mandir=/opt/local/share/man' 
'--infodir=/opt/local/share/info' '--program-suffix=54' 
'--includedir=/opt/local/include/php54' '--libdir=/opt/local/lib/php54' 
'--with-config-file-path=/opt/local/etc/php54' 
'--with-config-file-scan-dir=/opt/local/var/db/php54' '--disable-all' '--enable-bcmath' 
'--enable-ctype' '--enable-dom' '--enable-fileinfo' '--enable-filter' '--enable-hash' 
'--enable-json' '--enable-libxml' '--enable-pdo' '--enable-phar' '--enable-session' 
'--enable-simplexml' '--enable-tokenizer' '--enable-xml' '--enable-xmlreader' 
'--enable-xmlwriter' '--with-bz2=/opt/local' '--with-mhash=/opt/local' 
'--with-pcre-regex=/opt/local' '--with-libxml-dir=/opt/local' '--with-zlib=/opt/local' 
'--without-pear' '--disable-cgi' '--disable-cli' '--disable-fpm' 
'--with-apxs2=/opt/local/apache2/bin/apxs'

I notice there's no '--with-gd' in there, but I made no changes to PHP between this code working and breaking...

It is entirely possible that when I closed my laptop and then reopened, apache restarted. I did not install or upgrade anything (made absolutely no changes to php) or make any changes to any ini files or upgrade anything in the recent past. Today, however, I did do a full upgrade of everything installed using macports. Didn't fix the problem.

Is anyone else experiencing this problem/finding solutions?

链接地址: http://www.djcxy.com/p/57688.html

上一篇: 升级到php5.5后出现403错误

下一篇: PHP 5.4.12 Mac OSX imagecreate *函数无效