返回500内部服务器错误的PHP映像?

问题描述:

我有一些代码,增加了一些标头的图像:冠军background.png.php的返回500内部服务器错误的PHP映像?

内容:

<?php 
$im = imagecreatefrompng("title-background.png"); 

header('Cache-Control: public'); 
header('Content-type: image/png'); 
header('Expires: 19 Febuary 2012 20:00:00 GMT'); 

imagepng($im); 
imagedestroy($im); 
?> 

,这就是工作的罚款。但是,当我试图做同样的与另一个文件,

button.png.php的内容:与500

<?php 
$im1 = imagecreatefrompng("button.png"); 

header('Cache-Control: public'); 
header('Content-type: image/png'); 
header('Expires: 19 Febuary 2012 20:00:00 GMT'); 

imagepng($im1); 
imagedestroy($im1); 
?> 

服务器返回我有我的日志的访问权限。

+0

你检查了图像的路径吗?你有权访问该文件吗? – 0x60 2011-01-28 07:28:19

+0

尝试添加这些行到文件的开头,以防止500错误,然后看看你是否得到一个PHP错误:`??php error_reporting(E_ALL); ini_set('display_errors','on');回声“aaa”;使用ob_flush(); ?> – 2011-01-28 07:38:41

哇,抱歉的家伙 - 凌乱的*服务器。在我的早餐上吃了1分钟,我的工作就完成了......

title-background.png.php是从.css fie指向同一个服务器: - 但是,button.png.php来自不同的服务器!

我现在已经通过放置完整路径来修复它,包括http://'s等。

我怀疑button.png不存在,不能被读取,或者不知何故与imagecreatefrompng()不兼容。