The requested resource could not be found

Using MS SQL Server Express 2008 R2 create the Northwind database and use PHPMaker 2021 to generate a full project against it, navigating to the project URL gives this error:
{“statusCode”:404,“error”:{“class”:“text-warning”,“type”:“Not Found”,“description”:“The requested resource could not be found. Please verify the URL and try again.”}}

I have sqlsrv section clearly in phpinfo with “ExtensionVer 5.6.1+11919” and correctly installed php_sqlsrv_73_ts_x64.dll matching the Apache server setup. I also tried the pdo version… still same problem.

So used this simple script to test MSSQL connectivity:

<?php $serverName = "localhost\\MSSQL"; $connectionInfo = array( "Database"=>"Northwind", "UID"=>"sa", "PWD"=>"XXX"); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn ) { echo "Connection established.
"; }else{ echo "Connection could not be established.
"; die( print_r( sqlsrv_errors(), true)); } ?>

Result was: “Connection established.” so connectivity is fine…

This is my DB connection object for reference:
“DB” => [“id” => “DB”, “type” => “MSSQL”, “qs” => “[”, “qe” => “]”, “host” => “localhost\MSSQL”, “port” => null, “user” => “sa”, “password” => “XXX”, “dbname” => “Northwind”]

I think it’s a MSSQL specific issue since I can generate and run MySQL projects just fine.

  • RewriteBase is setup correctly because the system routes to the first default page correctly.
  • I’m using PHP 7.3

ashballan wrote:

{“statusCode”:404,“error”:{“class”:“text-warning”,“type”:“Not Found”,“description”:“The requested resource could not be found. Please verify the URL and try again.”}}

That is 404 Not Found error, it is not related to database.

Note that v2021 requires URL Rewrite, make sure you have setup your web server, read: https://discourse.hkvstore.com/t/migrating-to-v2022/655/1

URL Rewrite is enabled as per instructions “LoadModule rewrite_module modules/mod_rewrite.so”.

I have no idea how to setup RewriteBase if that is the issue. I’m using XAMPP and LARAGON servers on my machine so the document root in XAMPP is “C:/XAMPP/htdocs” and the app is under “C:/XAMPP/htdocs/NW_2021/”.

It routes to the default first page, in this case “localhost/nw_2021/CategoriesList” but then throws that error.

Any ideas?

ashballan wrote:

the document root in XAMPP is “C:/XAMPP/htdocs” and the app is under “C:/XAMPP/htdocs/NW_2021/”

https://discourse.hkvstore.com/t/migrating-to-v2022/655/1 mentions RewriteBase, you may read again.

You may also click Tools → Advanced Settings, find “RewriteBase directive”, try to enter /NW_2021 or “/NW_2021” (with or without quotes, depending on web server, you may try one by one, some web server does not need it) and try again.

Yes, I tried and verified all of the above. Even went through troubleshooting RewriteBase from here: docs.bolt.cm/4.0/howto/making-sure-htaccess-works

The server is setup correctly and so is .htaccess and RewriteBase. Going to the base URL “localhost/nw_2021/” routes correctly to the first page “localhost/nw_2021/CategoriesList” but the server can’t find a resource and throws the error:
{“statusCode”:404,“error”:{“class”:“text-warning”,“type”:“Not Found”,“description”:“The requested resource could not be found. Please verify the URI and try again.”}}

At this point please advice how to troubleshoot/debug the Slim framework. Is there a way to switch on “debug” mode to see what it’s trying to do?

Make sure you have already enabled the following settings from “Tools” → “Advanced Settings”:

  • Debug,
  • Log SQL to file,
  • Log error to file

then re-generate ALL the script files, and try again.

Thank you, I did that and the log file shows this:

[2020-10-06T13:01:19.410335+00:00]
log.DEBUG:
404 Not Found Type: Slim\Exception\HttpNotFoundException Code: 404 Message: Not found. File: C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\Middleware\RoutingMiddleware.php Line: 93
Trace:
#0 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\Middleware\RoutingMiddleware.php(59): Slim\Middleware\RoutingMiddleware->performRouting(Object(Slim\Http\ServerRequest))
#1 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\MiddlewareDispatcher.php(140): Slim\Middleware\RoutingMiddleware->process(Object(Slim\Http\ServerRequest), Object(class@anonymous))
#2 C:\XAMPP\htdocs\NW_2021\vendor\selective\samesite-cookie\src\SameSiteCookieMiddleware.php(52): class@anonymous->handle(Object(Slim\Http\ServerRequest))
#3 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\MiddlewareDispatcher.php(140): Selective\SameSiteCookie\SameSiteCookieMiddleware->process(Object(Slim\Http\ServerRequest), Object(class@anonymous))
#4 C:\XAMPP\htdocs\NW_2021\vendor\selective\samesite-cookie\src\SameSiteSessionMiddleware.php(50): class@anonymous->handle(Object(Slim\Http\ServerRequest))
#5 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\MiddlewareDispatcher.php(140): Selective\SameSiteCookie\SameSiteSessionMiddleware->process(Object(Slim\Http\ServerRequest), Object(class@anonymous))
#6 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\Middleware\ErrorMiddleware.php(107): class@anonymous->handle(Object(Slim\Http\ServerRequest))
#7 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\MiddlewareDispatcher.php(140): Slim\Middleware\ErrorMiddleware->process(Object(Slim\Http\ServerRequest), Object(class@anonymous))
#8 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\MiddlewareDispatcher.php(81): class@anonymous->handle(Object(Slim\Http\ServerRequest))
#9 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\App.php(215): Slim\MiddlewareDispatcher->handle(Object(Slim\Http\ServerRequest))
#10 C:\XAMPP\htdocs\NW_2021\vendor\slim\slim\Slim\App.php(199): Slim\App->handle(Object(Slim\Http\ServerRequest))
#11 C:\XAMPP\htdocs\NW_2021\index.php(98): Slim\App->run()
#12 {main}

Error “404 Not Found” means the requested page is not found or the requested page has not been included into the routes of your web application. Can you post the URL you accessed that caused the error?

You may check all the valid routes in src/routes.php. Make sure your route is among them.

If you have changed the setting “Lowercase output file name” (or “Lowercase routes”), you better delete all files in the project folder and generate them again.

I can confirm this issue has been fixed now… it seems a recent template update did the job. Thank you…

Having the same error as ashballan, Error says"“statusCode”:404,“error”:{“class”:“text-warning”,“type”:“Not Found”,“description”:“The requested resource could not be found. Please verify the URI and try again.”}}"Can anyone assist?Thanks

Make sure you have set up URL Rewrite for your web server properly.

I just created another site using a different database. It’s working. I’m assuming that means my URL Rewrite is working?Here’s a snippet of the error from the log"404 Not Found Type: Slim\Exception\HttpNotFoundException Code: 404 Message: Not found. File: C:\xampp\htdocs\php\RADModule\vendor\slim\slim\Slim\Middleware\RoutingMiddleware.php Line: 91 Trace: #0 C:\xampp\htdocs\php\RADModule\vendor\slim\slim\Slim\Middleware\RoutingMiddleware.php(58): Slim\Middleware\RoutingMiddleware->performRouting(Object(Slim\Http\ServerRequest)) #1 "Any suggestions?

As you know 404 error means a route cannot be found. If you believe URL Rewriting is working, you better check all links in your project. If you migrate from < v2020, you need to update all links to valid routes. Check your Start Page, server event, Return Pages, and all settings with URL.

Not really sure what happened but problem is now fixed. I did a lot of trial and error. I also tried to change the site name from one that had three capital letters to no capitals. It suddenly worked. I thought that was the reason but even after changing it back to three capital letters it is still working.I’m just happy it is now okay. Very new to php.Thanks all

Problem Fixed.Solution: When you setup RewriteBase path in the PHPMaker Project Tools > Advanced, then
you need to upload generated files into exactly the same folder that has the same folder name in your RewriteBase path.For example, what happened to me is I generated my projects files by giving “/olis11/” as my RewriteBase path in the project Tool > Advanced settings.
But upload the files into a folder called “demo11”.I several times I have fixed both .htaccess files in my root and api folders, but still, the error was shown to me.So what I did was rename the uploaded folder to “olis11” and then all errors were gone and fixed.
Remember I also edited the RewriteBase directives in both .htaccess files in the root and api folders.