Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP GD fails silently
    primarykey
    data
    text
    <p>I've been working on an image processing function that loads PNG files. While it works fine on my local server (Windows, PHP 5.3.6) on the remote server (FreeBSD, PHP 5.3.6) PHP returns a "500 Internal Server Error" when using imagecreatefrompng. Normally, I'd consult the logs in /var/log/php.log - but nothing is added to the log when I try and load the page. If I comment out the line containing imagecreatefrompng the script loads - albeit with many errors output into the log because of the missing image resource.</p> <p>I've tried adding:</p> <pre><code>ini_set('display_errors', 1); error_reporting(E_ALL); </code></pre> <p>to the code, no difference.</p> <p>The output of phpinfo shows that GD is loaded, the output of gd_info is:</p> <pre><code>array(12) { ["GD Version"]=&gt; string(27) "bundled (2.0.34 compatible)" ["FreeType Support"]=&gt; bool(true) ["FreeType Linkage"]=&gt; string(13) "with freetype" ["T1Lib Support"]=&gt; bool(true) ["GIF Read Support"]=&gt; bool(true) ["GIF Create Support"]=&gt; bool(true) ["JPEG Support"]=&gt; bool(true) ["PNG Support"]=&gt; bool(true) ["WBMP Support"]=&gt; bool(true) ["XPM Support"]=&gt; bool(true) ["XBM Support"]=&gt; bool(true) ["JIS-mapped Japanese Font Support"]=&gt; bool(false) } </code></pre> <p>At this point, I'm completely lost. Short of nuking my php install and trying over again, I don't know what to do. I plan to upgrade to 5.4 once the port is updated, but considering I can't tell what the issue is - I don't know if that will fix things.</p> <p>Here's a snippet of the code in question:</p> <pre><code>/* load image */ $imgname = '/images/'.$doctype.'_'.side($_GET['side']).".png"; $image_path = trim(shell_exec('pwd')).$imgname; if(!file_exists($image_path)){ trigger_error('Image file not found!'); exit; } $im = imagecreatefrompng($image_path); </code></pre> <p>I've gone as far as making sure I'm using the absolute path to the image, double checking the image exists (file_exists()) and errorring out if it doesn't. Regardless of what I do, as long as imagecreatefrompng is uncommented, I get a silent 500 error.</p> <p>Edit: I've added the snippet:</p> <pre><code>var_dump(is_readable($image_path)); var_dump(file_exists($image_path)); </code></pre> <p>to my code which results in:</p> <pre><code>bool(true) bool(true) </code></pre> <p>So it looks like the image file is readable by PHP. I've also verified the image is an actual PNG file. Any other ideas? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload