A
A
Alexander Drek2016-01-22 09:57:27
PHP
Alexander Drek, 2016-01-22 09:57:27

Why doesn't php-fpm + nginx return the generated image?

Hello! There is a site, it has a standard captcha code generation, it worked for many years, I will show only the end, so it is pointless to show the rest:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
  if (!isset($_GET['code']))
  header('Content-type: image/jpeg');
    
    imagejpeg($image);
    
    imagedestroy($image);

But the site does not display a picture, but generates a code .
The problem is clearly in the server settings. My problem is that I don't even know where to dig (php-fpm or nginx) or how to google it. Can anyone come across or can tell where the jamb or where to dig?
nginx config: codre.ru/temp/nginx.txt
In php.ini only: open_basedir = none; short_open_tag=on;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Drek, 2016-01-22
@drekon

Everything turned out to be banal and simple. \n\r in one of the included files, if it's easier to break the line before displaying the image code.
Also, one of the possible problems, in such a situation, is the UTF-8 with BOM encoding of the file.

A
Andrey, 2016-01-22
@VladimirAndreev

server error logs?
if you run the script from the console - will it display a picture?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question