Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-84890

Error code: generalexceptionmessage - line 76 of /lib/slim/slim/Slim/Middleware/RoutingMiddleware.php: Slim\Exception\HttpNotFoundException thrown

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.5.2
    • Libraries
    • None
    • MOODLE_405_STABLE

      Hi,

      I did a clean install of Moodle 4.5.2+ (Build: 20250314) but when I go to Home page in the first time I'm getting the below:

       

       

      In text format:

      Debug info:
      Error code: generalexceptionmessage×Dismiss this notificationStack trace:line 76 of /lib/slim/slim/Slim/Middleware/RoutingMiddleware.php: Slim\Exception\HttpNotFoundException thrownline 44 of /lib/slim/slim/Slim/Middleware/RoutingMiddleware.php: call to Slim\Middleware\RoutingMiddleware->performRouting()line 121 of /lib/slim/slim/Slim/MiddlewareDispatcher.php: call to Slim\Middleware\RoutingMiddleware->process()line 59 of /lib/classes/router/middleware/uri_normalisation_middleware.php: call to Psr\Http\Server\RequestHandlerInterface@anonymous/var/www/html/lib/slim/slim/Slim/MiddlewareDispatcher.php:108$74->handle()line 121 of /lib/slim/slim/Slim/MiddlewareDispatcher.php: call to core\router\middleware\uri_normalisation_middleware->process()line 76 of /lib/slim/slim/Slim/Middleware/ErrorMiddleware.php: call to Psr\Http\Server\RequestHandlerInterface@anonymous/var/www/html/lib/slim/slim/Slim/MiddlewareDispatcher.php:108$74->handle()line 121 of /lib/slim/slim/Slim/MiddlewareDispatcher.php: call to Slim\Middleware\ErrorMiddleware->process()line 65 of /lib/slim/slim/Slim/MiddlewareDispatcher.php: call to Psr\Http\Server\RequestHandlerInterface@anonymous/var/www/html/lib/slim/slim/Slim/MiddlewareDispatcher.php:108$74->handle()line 199 of /lib/slim/slim/Slim/App.php: call to Slim\MiddlewareDispatcher->handle()line 183 of /lib/slim/slim/Slim/App.php: call to Slim\App->handle()line 260 of /lib/classes/router.php: call to Slim\App->run()line 55 of /r.php: call to core\router->serve() 

      nginx log:

      2025/03/15 16:40:24 [error] 20#20: *63 FastCGI sent in stderr: "PHP message: 404 Not Found
      Type: Slim\Exception\HttpNotFoundException
      Code: 404
      Message: Not found.
      File: /var/www/html/lib/slim/slim/Slim/Middleware/RoutingMiddleware.php
      Line: 76
      Trace: #0 /var/www/html/lib/slim/slim/Slim/Middleware/RoutingMiddleware.php(44): Slim\Middleware\RoutingMiddleware->performRouting()
      #1 /var/www/html/lib/slim/slim/Slim/MiddlewareDispatcher.php(121): Slim\Middleware\RoutingMiddleware->process()
      #2 /var/www/html/lib/classes/router/middleware/uri_normalisation_middleware.php(59): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()
      #3 /var/www/html/lib/slim/slim/Slim/MiddlewareDispatcher.php(121): core\router\middleware\uri_normalisation_middleware->process()
      #4 /var/www/html/lib/slim/slim/Slim/Middleware/ErrorMiddleware.php(76): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()
      #5 /var/www/html/lib/slim/slim/Slim/MiddlewareDispatcher.php(121): Slim\Middleware\ErrorMiddleware->process()
      #6 /var/www/html/lib/slim/slim/Slim/MiddlewareDispatcher.php(65): Psr...; PHP message: Default exception handler: Exception - Not found. Debug: 
      Error code: generalexceptionmessage
      * line 76 of /lib/slim/slim/Slim/Middleware/RoutingMiddleware.php: Slim\Exception\HttpNotFoundException thrown
      * line 44 of /lib/slim/slim/Slim/Middleware/RoutingMiddleware.php: call to Slim\Middleware\RoutingMiddleware->performRouting()
      * line 121 of /lib/slim/slim/Slim/MiddlewareDispatcher.php: call to Slim\Middleware\RoutingMiddleware->process()
      * line 59 of /lib/classes/router/middleware/uri_normalisation_middleware.php: call to Psr\Http\Server\RequestHandlerInterface@anonymous/var/www/html/lib/slim/slim/Slim/MiddlewareDispatcher.php:108$74->handle()
      * line 121 of /lib/slim/slim/Slim/MiddlewareDispatcher.php: call to core\router\middleware\uri_normalisation_middleware->process()
      * line 76 of /lib/slim/slim/Slim/Middleware/ErrorMiddleware.php: call to Psr\Http\Server\RequestHandlerInterface@anonymous/var/www/html/lib/slim/slim/Slim/MiddlewareDi 

      When I up a container with Apache it works seamless. But with the nginx, there is this error.

      The complete project is here: https://github.com/antonio24073/moodle-docker (but maybe it's not needed to install it, just instll te nginx.

      My nginx configuration:

      server {
          listen 80;
          server_name localhost;
          root /var/www/html;
          index index.php index.html index.htm;    # Hide all dot files but allow "Well-Known URIs" as per RFC 5785
          location ~ /\.(?!well-known).* {
              return 404;
          }
          
          # This should be after the php fpm rule and very close to the last nginx ruleset.
          # Don't allow direct access to various internal files. See MDL-69333
          location ~ (/vendor/|/node_modules/|composer\.json|/readme|/README|readme\.txt|/upgrade\.txt|/UPGRADING\.md|db/install\.xml|/fixtures/|/behat/|phpunit\.xml|\.lock|environment\.xml) {
              deny all;
              return 404;
          }
          
          location / {
              try_files $uri /r.php;
          }    location ~ \.php(/|$) {
              # Split the path info based on URI.
              fastcgi_split_path_info ^(.+\.php)(/.*)$;        # Note: Store the original path_info. It will be wiped out in a moment by try_files.
              set $path_info $fastcgi_path_info;        # Look for the php file. If not round then jump to @routed.
              try_files $fastcgi_script_name $fastcgi_script_name/;        # File was found - pass to fastcgi.
              fastcgi_pass   unix:/run/php/php8.3-fpm.sock;
              include        fastcgi_params;        # Re-apply the path_info after including fastcgi_params.
              fastcgi_param PATH_INFO $path_info;
              fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
              fastcgi_param DOCUMENT_ROOT $realpath_root;
          }    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|otf|eot|ttf|svg|mp3|mp4|avi|mov|flv|wmv|webm)$ {
              root /var/www/html;
              try_files $uri /index.php?$query_string;
              expires max;
              log_not_found off;
              access_log off;
          }    location ^~ /moodledata/ {
              deny all;
              return 403;
          }
      }

      I'm new in the Moodle but I couldn't find any answer like mine and it seems that this slim is a new feature.

      The issue happens after this: https://tracker.moodle.org/browse/MDL-84543?jql=text%20~%20%22router.php%20on%20line%20115%22

      Best regards

       

       

        1. image-2025-03-15-13-36-27-515.png
          172 kB
          Antonio Augusto
        2. image-2025-03-19-18-53-42-653.png
          32 kB
          Antonio Augusto

            Unassigned Unassigned
            antonioaugusto Antonio Augusto
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.