php - 404 Not Found error when routing using silex -
i had following code, worked fine on php 5.6 , apache 2.2. think upgraded apache 2.4 , seems have stopped working.
api -app -job -jobcontroller.php -jobfacade.php -jobfacadeprovider.php -src -batchautoscalingapplication.php -routes.php -app.php -index.php
routes.php
<?php require_once __dir__ . "/../job/jobcontroller.php"; $app->mount("/job", new jobcontroller()); ?>
jobcontroller.php
<?php require_once __dir__ ."/jobfacade.php"; class jobcontroller implements controllerproviderinterface { public function connect(application $app) { $controllers = $app['controllers_factory']; error_log("isnide cntroller",false); $controllers->get('/isacceptable', function (request $request) use ($app) { $id_contents = $request->query->get('id_contents'); $result = $app['job']->isacceptable($id_contents, $id_host, $id_vhost, $private_ip); return new jsonresponse($result); }); return $controllers; } public function boot(application $app) { // todo: implement boot() method. } } ?>
jobfacade.php
class jobfacade { public function isacceptable($id_contents) { return "something" } }
jobfacadeprovider.php
class jobfacadeprovider implements serviceproviderinterface { public function register(application $app) { $app['job'] = $app->share(function() use ($app) { return new jobfacade(); }); } public function boot(application $app) {} }
index.php
$app = require_once __dir__ . '/app/app.php'; $app->after($app["cors"]); $app->run(); ?>
batchautoscalingapplication.php
class batchautoscalingapplication extends application { public function __construct(array $values = array()) { parent::__construct($values); $this->register(new corsserviceprovider(), array( "cors.alloworigin" => "*", )); $this->register(new jobfacadeprovider()); } }
app.php
$app = new batchautoscalingapplication(); require_once __dir__ . '/src/routes.php'; return $app; ?>
when hit url http://<host>/job/isacceptable?id_contents=34
, gives me following error
404 not found
the requested url /job/isacceptable not found on server
ps: documentroot pointed api
directory.
it silly mistake. added allowoverride all
in httpd.conf
, seems work ok.
Comments
Post a Comment