cyanide_pierce — 2012-03-28T15:56:33-04:00 — #1
I was wondering if can or should be able to connect to database from my local machine
Example my constants file
This works fine from my http://www.mysite.com
Database connections and database selection works along with retriving data.
If i want to download the files and work on my comp with the same constants file work
Will localhost/htdocs/mysite.com still be able to work
So far i am getting this error
Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in D:\xampp\htdocs\ utorials\countrysideni.org\includes\db_connection.php on line 10
Database connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Is it because what I am trying to do will never ever work or do i need to change some settings?
serverstorm — 2012-03-28T16:13:33-04:00 — #2
Your local computer is most likely protected by a firewall, it by default will not open port 3308 which you need to connect so you would need to NAT this open from within your firewall if it will allow you. However, this is not a good idea as it leaves your machine vulnerable. One option is to build a PFSense Firewall on a old tower you have, you then install open-vpn on it, create certificates and then open the vpn prior to connecting to your database. If you used open-vpn you would not need to open and NAT the mysql port.
I do this all the time with my work and home servers and it works very reliably!
cyanide_pierce — 2012-03-28T16:28:32-04:00 — #3
Thanks for the info but thats a little bit beyond my skills right now, plus it is for a group project in university. We planned to work on seperate pages with PHP and use the mysql database on the uni server, but we decided to work localy on our own xampp and upload the final database when were finished
serverstorm — 2012-03-28T17:08:25-04:00 — #4
Yes you came up with a good solution that does not require near the same work to do Good job, and good luck with you project!
You might want to look at GIT for sharing your scripts and keeping the scripts under version control. Version control can be tough when working with a group, so using something like GitHub might server you well.