I am new to symfony 2.3 I have a problem in running an independent php file from my controller. I want to run that file from shell_exec() and to use it's output in my code. But i dont know the right way that where to locate that file I want to run. my controller code as follows
namespace my\apiBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
Class newController extends Controller
{
public function getlibAction($text)
{
$out = shell_exec("php script/data.php");
/*
my rest code to take data from output
*/
$response = new Response();
$response->headers->set('Content-Type', 'text/html');
$response->setContent($out);
return $response;
}
}
I have copied the "script/" folder containing "data.php" to the "my/apiBundle/Resources/public/" but i could not access it . And I try to copy it independently in "my/apiBundle/" but it was still not successful.
I dont know eher should i locate it. Please help me out of this issue. Thanks in advance..