Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure phpseclib in Symfony 3? #1097

Open
shahroznawaz opened this issue Feb 18, 2017 · 6 comments
Open

How to configure phpseclib in Symfony 3? #1097

shahroznawaz opened this issue Feb 18, 2017 · 6 comments
Labels

Comments

@shahroznawaz
Copy link

I need to configure it in symfony 3 what should I write in AppKernel.php to enable the bundle?

@bantu
Copy link
Member

bantu commented Feb 18, 2017

phpseclib does not provide a Symfony bundle.

@shahroznawaz
Copy link
Author

So any other way to configure it?

@bantu
Copy link
Member

bantu commented Feb 18, 2017

So any other way to configure it?

It's a library. You create object and pass arguments.

@shahroznawaz
Copy link
Author

shahroznawaz commented Feb 18, 2017

Thanks @bantu I tried this but it didn't working.

`namespace AppBundle\Controller;
use phpseclib\Net\SFTP;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
/**
* @route("/", name="homepage")
*/
public function indexAction(Request $request)
{
$sftp = new SFTP('46.xxxx.5.xx3');

    if (!$sftp->login('mastexxxxxxxxkh', 'f6xxxxx6')) {
        throw new \Exception('Cannot login into your server !');
    }
    else echo $sftp;
    // replace this example code with whatever you need
    return $this->render('default/test.html.twig', [
        'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
    ]);
   }
}`

Any Idea what's wrong?

@bantu
Copy link
Member

bantu commented Feb 18, 2017

but it didn't working

Please explain. What is the expected behaviour? What is the actual behaviour? Any error message? Did you check the logs?

else echo $sftp;

I am not sure SFTP implements toString() and this works.

@bantu bantu added the support label Feb 18, 2017
@shahroznawaz
Copy link
Author

yes it's giving 500 internal error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants