Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP and SSH

  • 11-01-2008 4:02pm
    #1
    Closed Accounts Posts: 25,848 ✭✭✭✭


    Hi guys

    I am trying to set up a SSH tunnel with port mapping to a database server so I can connect using Postgresql PHP command pg_connect to tunnel through the SSH connection to the database

    Basically something like this
    $ssh_com = "ssh -L 5432:db_server:5432 wicknight@db_server &";
    exec ($ssh_com);
    
    pg_connect ("host=localhost port=5432 user=wicknight etc etc");
    

    I have a pub/private key set up under the apache user so the SSH command doesn't need a password The ssh command runs fine from the command line under the apache user and I can run just a normal ssh command to like read a directory or something just fine.

    it seems to just run and stop as if finsihed when run from PHP.

    Anyone know how to get this to work?

    Or is this a really dumb way of doing what I want (basically the database server is in a DMZ that only allows ssh but I still want to be able to connect to the DB)


Advertisement