Страница 1 из 1

Ошибка сервера 505

Добавлено: 24 мар 2017, 08:19
Серега_123
Всем привет! Кто-нибудь встречался с подобной ошибкой? Как ее решить?

Пользуюсь OpenServer. Выдает такую вот ошибку:
Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.

Error 500

localhost
Apache

Лог запросов вот такой вот:
Nginx запросы (localhost: 127.0.0.1 [24/Mar/2017:11:41:47 +0600] "GET /site/captcha.php HTTP/1.1" "-" 500 1388 "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36" "-")

Apache запросы (localhost: 127.0.0.1 [24/Mar/2017:11:41:47 +0600] "GET /site/captcha.php HTTP/1.0" 500 1047 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36")

Apache отладка ([Fri Mar 24 11:41:47.049775 2017] [http:error] [pid 2348:tid 632] [client 127.0.0.1:1776] AH02429: Response header name 'Content type' contains invalid characters, aborting request)

Re: Ошибка сервера 505

Добавлено: 24 мар 2017, 10:16
Asmodey
Серега_123 писал(а):AH02429: Response header name 'Content type' contains invalid characters, aborting request)
А что Вы там пытаетесь ему отдать?

Re: Ошибка сервера 505

Добавлено: 24 мар 2017, 12:45
Серега_123
я пытаюсь вот этот скрипт из файла captcha.php:
<?php
session_start();
$rand = mt_rand(1000, 9999);
$_SESSION["rand"] = $rand;
$im = imageCreateTrueColor(90, 50);
$c = imageColorAllocate($im, 255, 255, 255);
imageTtfText($im, 20, -10, 10, 30, $c, "fonts/verdana.ttf", $rand);
header("Content type: image/png");
imagePng($im);
imagedestroy($im);
?>
передать вот в эту форму:
<h2>Вход на сайт</h2>
%message%
<form name="auth" action="functions.php" method="post">
    <table>
    <tr>
        <td>Логин:</td>
        <td>
            <input type="text" name="login"/>
        </td>
    </tr>
    <tr>
        <td>Пароль:</td>
        <td>
            <input type="password" name="password" value="%login%"/>
        </td>
    </tr>
    <tr>
        <td colspan="2" align="center">
            <img src="%address%captcha.php" alt="Каптча" />
        </td>
    </tr>
    <tr>
        <td>Проверочный код</td>
        <td>
            <input type="text" name="captcha" />
        </td>
    </tr>
    <tr>
        <td colspan ="2" align="right">
            <input type="submit" name="auth" value="Зарегистрироваться" />
        </td>
    </tr>
    </table>
</form>

Re: Ошибка сервера 505

Добавлено: 24 мар 2017, 16:13
Asmodey
Как я понимаю %address% - тэги поелись.
Оба файла корректные.
Уберите закрывающий тег в captcha.php (так на всякий). В логах php есть что-нибудь подозрительное?

Re: Ошибка сервера 505

Добавлено: 24 мар 2017, 20:56
Максим
Серега_123 писал(а):header("Content type: image/png");
Мда. header("Content-Type: image/png");