Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Error 500, when robot open Phalcon micro app

Hello! Sory my English.

I have Phalcon micro application. When I open my site in a browser, Nginx shows code 200 and no errors in log. But, when robot open my site, Nginx show code 500:

HTTP/1.1 500 Internal Server Error
Server: nginx
Date: Tue, 30 May 2017 08:12:58 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive

Access log:

"HEAD / HTTP/1.1" 500 -

Error log:

PHP Fatal error:  Uncaught Phalcon\\Mvc\\Micro\\Exception: Not-Found handler is not callable or is not defined in /home/srv/http/projects/lorhealth.localhost/public/index.php:19\nStack trace:\n#0 /home/srv/http/projects/lorhealth.localhost/public/index.php(19): Phalcon\\Mvc\\Micro->handle()\n#1 {main}\n  thrown in /home/srv/http/projects/lorhealth.localhost/public/index.php on line 9

public/index.php:

<?php
error_reporting(E_ALL);
define('ROOT_PATH', __DIR__ . '/../');
include ROOT_PATH . 'app/config/config.php';
include ROOT_PATH . 'app/config/loader.php';
$app = new Phalcon\Mvc\Micro();
include ROOT_PATH . 'app/config/services.php';
include ROOT_PATH . 'app/config/routes.php';
$app->handle();

What could be the problem?



49.6k
Accepted
answer
edited May '17

Robots are making HEAD / HTTP/1.1 requests. Your Micro does not have route / controller to handle HEAD routes / requests.

That's why you can access it with a browser, as browsers make GET requests.

If you're using MicroCollection class for routes, take a look at: https://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Micro_Collection.html