Jump to content

create VPN with PHP


vladn

Recommended Posts

I've got a DB server on client side on a local computer with a local IP (192.168.1.12). My Web server is on a different network on a different IP, obviously I can't really connect to the DB server. The client gave me a VPN access to his DB server. So now I am wandering if I can create in PHP a VNP tunnel or something similar and get the data from the server through VPN connection.

 

thanks.

Link to comment
Share on other sites

configure your firewall so that you can access the database from the internet.

 

ie 0.0.0.0:3306 would forward to your MySQL database.

 

Othewise for PHP to access it the server that PHP is running on needs to do the VPN connection itself.

 

What you can do is have PHP do a command call like exec() and launch the VPN connection. You will not need any special PHP code, PHP can access it just like if that database server was in the local network (That's in fact the definition of Virtual Private Network).

 

You can have PHP close the VPN connection via command line (if you have a VPN client that works through command line).

 

If it's not possible to create the VPN connection via command line, and therefore through PHP. You need to manually log on to the computer and initialize the VPN connection. This would not be bad if your PHP application is known to run at specific time or is run manually, such as a script.

 

Let me know if any questions,

 

 

 

 

 

Dan

 

 

I found this through the internet, I don't know if it will solve your problem or not.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.