Slim-3 php framework shows page not found error even the url is correct?cakePHP validationloop through the error message bags and then create a new arrayangular2 with Slim framework jwt authenticationERROR Class appAuth not found - slim framework v3 middlewareRedirecting with error on Slim FrameworkRedirecting to another page on error with Slim FrameworkHow to handle the ajax response with jquery?Object not found! Error 404 page with slim404 not found Slim FrameworkSlim 3 Framework route error - Page not Found
What makes MOVEQ quicker than a normal MOVE in 68000 assembly?
Can a creature sustain itself by eating its own severed body parts?
Authorship dispute on a paper that came out of a final report of a course?
What does "mossette" translate to in English
Did Hitler say this quote about homeschooling?
What could make large expeditions ineffective for exploring territory full of dangers and valuable resources?
Extract the attribute names from a large number of Shapefiles
Is it possible to have a career in SciComp without contributing to arms research?
How electronics on board of JWST can survive the low operating temperature while it's difficult to survive lunar night?
Inside Out and Back to Front
Why are flying carpets banned while flying brooms are not?
Are there any satellites in geosynchronous but not geostationary orbits?
A "Replace" sort problem. Basic but haunts me
Counting multiples of 3 up to a given number
Suggestions for how to track down the source of this force:source:push error?
Do pedestrians imitate automotive traffic?
What is the intuition for higher homotopy groups not vanishing?
What is the function of "mal" in saying "Das nenn ich mal ein X"?
What are my hardware upgrade optoins for a late 2009 iMac?
Function over a list that depends on the index
Should I have one hand on the throttle during engine ignition?
Discontinuous Tube visualization
Is "repository" pronounced /rɪˈpɒzɪt(ə)ri/ or ri-ˈpä-zə-ˌtȯr-ē or /rəˈpäzəˌtôrē/?
Why is the Intel 8086 CPU called a 16-bit CPU?
Slim-3 php framework shows page not found error even the url is correct?
cakePHP validationloop through the error message bags and then create a new arrayangular2 with Slim framework jwt authenticationERROR Class appAuth not found - slim framework v3 middlewareRedirecting with error on Slim FrameworkRedirecting to another page on error with Slim FrameworkHow to handle the ajax response with jquery?Object not found! Error 404 page with slim404 not found Slim FrameworkSlim 3 Framework route error - Page not Found
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Slim-3 php framework shows page not found error even the url is correct.
I am writing webservice for android application in php using slim3 framework.
few days before it was working fine.same code is not working now.It always returns page not found.i think error in the index.php file but i can't figure it out.
I have tried almost anything that i can get to solve this problem.
I changed the directory structure and .htaccess file but still not solved.i am using xampp server.
index.php
<?php
use PsrHttpMessageServerRequestInterface as Request;
use PsrHttpMessageResponseInterface as Response;
require '../ChickenShop/vendor/autoload.php';
require_once '../ChickenShop/public/includes/DbOperations.php';
//Creating a new app with the config to show errors
$app = new SlimApp([
'settings' => [
'displayErrorDetails' => true
]
]);
//registering a new user
$app->post('/register', function (Request $request, Response $response)
if (isTheseParametersAvailable(array('name', 'email', 'password', 'phone','address')))
$requestData = $request->getParsedBody();
$name = $requestData['name'];
$email = $requestData['email'];
$password = $requestData['password'];
$phone = $requestData['phone'];
$address = $requestData['address'];
$db = new DbOperations();
$responseData = array();
$result = $db->registerUser($name, $email, $password, $phone, $address);
if ($result == USER_CREATED)
$responseData['error'] = false;
$responseData['message'] = 'Registered successfully';
$responseData['user'] = $db->getUserByEmail($email);
elseif ($result == USER_CREATION_FAILED)
$responseData['error'] = true;
$responseData['message'] = 'Some error occurred';
elseif ($result == USER_EXIST)
$responseData['error'] = true;
$responseData['message'] = 'This email already exist, please login';
$response->getBody()->write(json_encode($responseData));
);
//user login route
$app->post('/login', function (Request $request, Response $response)
if (isTheseParametersAvailable(array('email', 'password')))
$requestData = $request->getParsedBody();
$email = $requestData['email'];
$password = $requestData['password'];
$db = new DbOperations();
$responseData = array();
if ($db->userLogin($email, $password))
$responseData['error'] = false;
$responseData['user'] = $db->getUserByEmail($email);
else
$responseData['error'] = true;
$responseData['message'] = 'Invalid email or password';
$response->getBody()->write(json_encode($responseData));
);
//getting all products
$app->get('/products', function (Request $request, Response $response)
$db = new DbOperations();
$products = $db->getAllProducts();
$response->getBody()->write(json_encode(array("products" => $products)));
);
//function to check parameters
function isTheseParametersAvailable($required_fields)
$error = false;
$error_fields = "";
$request_params = $_REQUEST;
foreach ($required_fields as $field) strlen(trim($request_params[$field])) <= 0)
$error = true;
$error_fields .= $field . ', ';
if ($error)
$response = array();
$response["error"] = true;
$response["message"] = 'Required field(s) ' . substr($error_fields, 0, -2) . ' is missing or empty';
echo json_encode($response);
return false;
return true;
// Run app
$app->run();
URL that i have tried to access:
http://localhost/ChickenShop/public/
Content of .htaccess file:
RewriteEngine On
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^ index.php [QSA,L]
i expected it to work fine.
php slim-3
add a comment |
Slim-3 php framework shows page not found error even the url is correct.
I am writing webservice for android application in php using slim3 framework.
few days before it was working fine.same code is not working now.It always returns page not found.i think error in the index.php file but i can't figure it out.
I have tried almost anything that i can get to solve this problem.
I changed the directory structure and .htaccess file but still not solved.i am using xampp server.
index.php
<?php
use PsrHttpMessageServerRequestInterface as Request;
use PsrHttpMessageResponseInterface as Response;
require '../ChickenShop/vendor/autoload.php';
require_once '../ChickenShop/public/includes/DbOperations.php';
//Creating a new app with the config to show errors
$app = new SlimApp([
'settings' => [
'displayErrorDetails' => true
]
]);
//registering a new user
$app->post('/register', function (Request $request, Response $response)
if (isTheseParametersAvailable(array('name', 'email', 'password', 'phone','address')))
$requestData = $request->getParsedBody();
$name = $requestData['name'];
$email = $requestData['email'];
$password = $requestData['password'];
$phone = $requestData['phone'];
$address = $requestData['address'];
$db = new DbOperations();
$responseData = array();
$result = $db->registerUser($name, $email, $password, $phone, $address);
if ($result == USER_CREATED)
$responseData['error'] = false;
$responseData['message'] = 'Registered successfully';
$responseData['user'] = $db->getUserByEmail($email);
elseif ($result == USER_CREATION_FAILED)
$responseData['error'] = true;
$responseData['message'] = 'Some error occurred';
elseif ($result == USER_EXIST)
$responseData['error'] = true;
$responseData['message'] = 'This email already exist, please login';
$response->getBody()->write(json_encode($responseData));
);
//user login route
$app->post('/login', function (Request $request, Response $response)
if (isTheseParametersAvailable(array('email', 'password')))
$requestData = $request->getParsedBody();
$email = $requestData['email'];
$password = $requestData['password'];
$db = new DbOperations();
$responseData = array();
if ($db->userLogin($email, $password))
$responseData['error'] = false;
$responseData['user'] = $db->getUserByEmail($email);
else
$responseData['error'] = true;
$responseData['message'] = 'Invalid email or password';
$response->getBody()->write(json_encode($responseData));
);
//getting all products
$app->get('/products', function (Request $request, Response $response)
$db = new DbOperations();
$products = $db->getAllProducts();
$response->getBody()->write(json_encode(array("products" => $products)));
);
//function to check parameters
function isTheseParametersAvailable($required_fields)
$error = false;
$error_fields = "";
$request_params = $_REQUEST;
foreach ($required_fields as $field) strlen(trim($request_params[$field])) <= 0)
$error = true;
$error_fields .= $field . ', ';
if ($error)
$response = array();
$response["error"] = true;
$response["message"] = 'Required field(s) ' . substr($error_fields, 0, -2) . ' is missing or empty';
echo json_encode($response);
return false;
return true;
// Run app
$app->run();
URL that i have tried to access:
http://localhost/ChickenShop/public/
Content of .htaccess file:
RewriteEngine On
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^ index.php [QSA,L]
i expected it to work fine.
php slim-3
Anyone alive here... :(
– Imran Anwar
Mar 28 at 11:25
Your question does not provide clear information. For example, what is url you tried to access, the content of your .htaccess, your project directory structures, etc.
– Zamrony P. Juhara
Mar 28 at 12:16
question is edited.now almost every info is provided.
– Imran Anwar
Mar 31 at 19:41
add a comment |
Slim-3 php framework shows page not found error even the url is correct.
I am writing webservice for android application in php using slim3 framework.
few days before it was working fine.same code is not working now.It always returns page not found.i think error in the index.php file but i can't figure it out.
I have tried almost anything that i can get to solve this problem.
I changed the directory structure and .htaccess file but still not solved.i am using xampp server.
index.php
<?php
use PsrHttpMessageServerRequestInterface as Request;
use PsrHttpMessageResponseInterface as Response;
require '../ChickenShop/vendor/autoload.php';
require_once '../ChickenShop/public/includes/DbOperations.php';
//Creating a new app with the config to show errors
$app = new SlimApp([
'settings' => [
'displayErrorDetails' => true
]
]);
//registering a new user
$app->post('/register', function (Request $request, Response $response)
if (isTheseParametersAvailable(array('name', 'email', 'password', 'phone','address')))
$requestData = $request->getParsedBody();
$name = $requestData['name'];
$email = $requestData['email'];
$password = $requestData['password'];
$phone = $requestData['phone'];
$address = $requestData['address'];
$db = new DbOperations();
$responseData = array();
$result = $db->registerUser($name, $email, $password, $phone, $address);
if ($result == USER_CREATED)
$responseData['error'] = false;
$responseData['message'] = 'Registered successfully';
$responseData['user'] = $db->getUserByEmail($email);
elseif ($result == USER_CREATION_FAILED)
$responseData['error'] = true;
$responseData['message'] = 'Some error occurred';
elseif ($result == USER_EXIST)
$responseData['error'] = true;
$responseData['message'] = 'This email already exist, please login';
$response->getBody()->write(json_encode($responseData));
);
//user login route
$app->post('/login', function (Request $request, Response $response)
if (isTheseParametersAvailable(array('email', 'password')))
$requestData = $request->getParsedBody();
$email = $requestData['email'];
$password = $requestData['password'];
$db = new DbOperations();
$responseData = array();
if ($db->userLogin($email, $password))
$responseData['error'] = false;
$responseData['user'] = $db->getUserByEmail($email);
else
$responseData['error'] = true;
$responseData['message'] = 'Invalid email or password';
$response->getBody()->write(json_encode($responseData));
);
//getting all products
$app->get('/products', function (Request $request, Response $response)
$db = new DbOperations();
$products = $db->getAllProducts();
$response->getBody()->write(json_encode(array("products" => $products)));
);
//function to check parameters
function isTheseParametersAvailable($required_fields)
$error = false;
$error_fields = "";
$request_params = $_REQUEST;
foreach ($required_fields as $field) strlen(trim($request_params[$field])) <= 0)
$error = true;
$error_fields .= $field . ', ';
if ($error)
$response = array();
$response["error"] = true;
$response["message"] = 'Required field(s) ' . substr($error_fields, 0, -2) . ' is missing or empty';
echo json_encode($response);
return false;
return true;
// Run app
$app->run();
URL that i have tried to access:
http://localhost/ChickenShop/public/
Content of .htaccess file:
RewriteEngine On
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^ index.php [QSA,L]
i expected it to work fine.
php slim-3
Slim-3 php framework shows page not found error even the url is correct.
I am writing webservice for android application in php using slim3 framework.
few days before it was working fine.same code is not working now.It always returns page not found.i think error in the index.php file but i can't figure it out.
I have tried almost anything that i can get to solve this problem.
I changed the directory structure and .htaccess file but still not solved.i am using xampp server.
index.php
<?php
use PsrHttpMessageServerRequestInterface as Request;
use PsrHttpMessageResponseInterface as Response;
require '../ChickenShop/vendor/autoload.php';
require_once '../ChickenShop/public/includes/DbOperations.php';
//Creating a new app with the config to show errors
$app = new SlimApp([
'settings' => [
'displayErrorDetails' => true
]
]);
//registering a new user
$app->post('/register', function (Request $request, Response $response)
if (isTheseParametersAvailable(array('name', 'email', 'password', 'phone','address')))
$requestData = $request->getParsedBody();
$name = $requestData['name'];
$email = $requestData['email'];
$password = $requestData['password'];
$phone = $requestData['phone'];
$address = $requestData['address'];
$db = new DbOperations();
$responseData = array();
$result = $db->registerUser($name, $email, $password, $phone, $address);
if ($result == USER_CREATED)
$responseData['error'] = false;
$responseData['message'] = 'Registered successfully';
$responseData['user'] = $db->getUserByEmail($email);
elseif ($result == USER_CREATION_FAILED)
$responseData['error'] = true;
$responseData['message'] = 'Some error occurred';
elseif ($result == USER_EXIST)
$responseData['error'] = true;
$responseData['message'] = 'This email already exist, please login';
$response->getBody()->write(json_encode($responseData));
);
//user login route
$app->post('/login', function (Request $request, Response $response)
if (isTheseParametersAvailable(array('email', 'password')))
$requestData = $request->getParsedBody();
$email = $requestData['email'];
$password = $requestData['password'];
$db = new DbOperations();
$responseData = array();
if ($db->userLogin($email, $password))
$responseData['error'] = false;
$responseData['user'] = $db->getUserByEmail($email);
else
$responseData['error'] = true;
$responseData['message'] = 'Invalid email or password';
$response->getBody()->write(json_encode($responseData));
);
//getting all products
$app->get('/products', function (Request $request, Response $response)
$db = new DbOperations();
$products = $db->getAllProducts();
$response->getBody()->write(json_encode(array("products" => $products)));
);
//function to check parameters
function isTheseParametersAvailable($required_fields)
$error = false;
$error_fields = "";
$request_params = $_REQUEST;
foreach ($required_fields as $field) strlen(trim($request_params[$field])) <= 0)
$error = true;
$error_fields .= $field . ', ';
if ($error)
$response = array();
$response["error"] = true;
$response["message"] = 'Required field(s) ' . substr($error_fields, 0, -2) . ' is missing or empty';
echo json_encode($response);
return false;
return true;
// Run app
$app->run();
URL that i have tried to access:
http://localhost/ChickenShop/public/
Content of .htaccess file:
RewriteEngine On
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^ index.php [QSA,L]
i expected it to work fine.
php slim-3
php slim-3
edited Mar 31 at 19:37
Imran Anwar
asked Mar 26 at 11:44
Imran AnwarImran Anwar
3210 bronze badges
3210 bronze badges
Anyone alive here... :(
– Imran Anwar
Mar 28 at 11:25
Your question does not provide clear information. For example, what is url you tried to access, the content of your .htaccess, your project directory structures, etc.
– Zamrony P. Juhara
Mar 28 at 12:16
question is edited.now almost every info is provided.
– Imran Anwar
Mar 31 at 19:41
add a comment |
Anyone alive here... :(
– Imran Anwar
Mar 28 at 11:25
Your question does not provide clear information. For example, what is url you tried to access, the content of your .htaccess, your project directory structures, etc.
– Zamrony P. Juhara
Mar 28 at 12:16
question is edited.now almost every info is provided.
– Imran Anwar
Mar 31 at 19:41
Anyone alive here... :(
– Imran Anwar
Mar 28 at 11:25
Anyone alive here... :(
– Imran Anwar
Mar 28 at 11:25
Your question does not provide clear information. For example, what is url you tried to access, the content of your .htaccess, your project directory structures, etc.
– Zamrony P. Juhara
Mar 28 at 12:16
Your question does not provide clear information. For example, what is url you tried to access, the content of your .htaccess, your project directory structures, etc.
– Zamrony P. Juhara
Mar 28 at 12:16
question is edited.now almost every info is provided.
– Imran Anwar
Mar 31 at 19:41
question is edited.now almost every info is provided.
– Imran Anwar
Mar 31 at 19:41
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55356339%2fslim-3-php-framework-shows-page-not-found-error-even-the-url-is-correct%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55356339%2fslim-3-php-framework-shows-page-not-found-error-even-the-url-is-correct%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Anyone alive here... :(
– Imran Anwar
Mar 28 at 11:25
Your question does not provide clear information. For example, what is url you tried to access, the content of your .htaccess, your project directory structures, etc.
– Zamrony P. Juhara
Mar 28 at 12:16
question is edited.now almost every info is provided.
– Imran Anwar
Mar 31 at 19:41